Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Back to Basics

Status
Not open for further replies.

adiMasher

Programmer
Aug 31, 2001
144
US
Alright it's come down to this.

I have this piece of example code posted straight from microsoft.

And I want to compile it and run it. It says I should link to these libraries

Mssdk\Lib\Advapi32.lib
Mssdk\Lib\Kernel32.lib
Ntddk\Libfre\I386\Lsadll.lib
Ntddk\Libfre\I386\Ntdll.lib

How do I link directly to those libraries?

Also after I downloaded the core SDK and the DDK I got some newer files. and this sample code asks for ntsecapi.h which is normally included but there are newer versions in the ntddk and the microsoft sdk directories. How do I handle this?

Thanks,
Martin Asher
masher@adi-cs.com
 
1. As IonFilipsky already pointed you (i thought you've done that already), use project->settings->Link[GeneralSubDlg]->Object/Library Modules. Type there Advapi32.lib Kernel32.lib Lsadll.lib Ntdll.lib . This is the way you link directly to the libraries.

2. Then, include the headers requested for the functions. You may find those in MSDN usually, at the bottom of a page describing a specific function.

3. And finally, if the header files ar NOT in the directories known by visual C, be sure to specify those directories manually, in Tools->Options->Directories.

4. You have to specify there also the directories for the LIBRARIES, so be careful with that, i had a lot of headackes myself for that...
There are include directories there for headers AND for static libs!

Hope this helps.
[red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
 
theese libraries are used by default. If not, add them in
menu:
Project->Settings->Link->Object/Library modules Ion Filipski
1c.bmp


filipski@excite.com
 
right... [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
 
Ok that is what I've been doing. And I'm sorry for the confusion about this I'm pretty much bouncing between different projects but trying to keep the questions general enough to answer them all at once.

So with this one I have libraries in two different directories

ntddk\libfre\i386
and
Program Files\Microsoft SDK\lib

Now I went into tools and set my directories but it has an order of precedence. So if I put ntddk\libfre\i386 it will look there first for all the libs it needs. but I want to specify individually each file that I want.

Now I know you said go into project->settings->link and all that but can I specify individually there by saying

"Program Files\Microsoft SDK\Lib\Advapi32.lib" "Program Files\Microsoft SDK\Lib\Kernel32.lib" Ntddk\Libfre\I386\Lsadll.lib Ntddk\Libfre\I386\Ntdll.lib

Or am I doing something wrong there?

second of all I need to make sure
when I say
#include <winbase.h>
that gets it from the include directory under tools->options...
#include &quot;whatever.h&quot;
can also include
#include &quot;my\directory\whatever.h&quot;
is this right? my book just says anything in the include statement between double quotes, the compiler has a separate manner of handling it than if in angle brackets.


And if that's not enough? Do you think I'd just be better off taking the specific files I need, putting them in a directory all of their own and just have the compiler point at that one directory?

Thanks,
Martin
 
I think you should add full directory names used by you to aditional libarry path:
in project->Settings->Category->Input
after that add only needed library names. If you want to use temporary other libs than used by default with the same name, you can try to put not needed in other directory and restpre them after that, or to reset all default libraries. Anyway this is not a safe type using them. Ion Filipski
1c.bmp


filipski@excite.com
 
I want to thank you both Ion and Nosferatu. I was finally able to make the sample code work and actually with two different types of libs. One was the secur32.lib for 2000 machines and ntdll.lib and lsadll.lib for 4.0 and under. Only bad thing is that my original problem is still unsolved. I ended up just playing with the order of the include and library directories under tools->options until it compiled. And once it compiled and linked it ran both under w2k and nt 4.0.

But my original problem remains. Which I think you'll be pretty interested to hear what I've come up with so far. After I downloaded the DDK and the SDK I finally found that CreateProcessWithLogonW does exist inside winbase.h. Just the more recent ddk and sdk's though. Other thing is that it only exists as unicode so there is no CreateProcessWithLogonA. I'm still playing around with the library directories and include directories because for some reason it will recognize the command if I completely leave out the standard libs and includes but it doesn't have access to the other regular needed libraries.

Any who I'm on the right track now.

Thanks again you guys,
Martin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top