Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

cannot link to _CreateProcessWithLogonW@40

30 views
Skip to first unread message

ILiya

unread,
Apr 20, 2008, 2:37:51 PM4/20/08
to
I have no CreateProcessWithLogonW defined in my winbase.h file. But it does exists in advapi32.lib file as _CreateProcessWithLogonW@40. To aliviate this mishap, I've just added following:
__declspec(dllimport) BOOL __stdcall CreateProcessWithLogonW(
LPCWSTR lpUsername,
LPCWSTR lpDomain,
LPCWSTR lpPassword,
DWORD dwLogonFlags,
LPCWSTR lpApplicationName,
LPWSTR lpCommandLine,
DWORD dwCreationFlags,
LPVOID lpEnvironment,
LPCWSTR lpCurrentDirectory,
LPSTARTUPINFOW lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInfo
);
function declaration at the beginnig of my "c" file.
The problem is the link error unresolved external symbol __imp__CreateProcessWithLogonW@44 . The number 44 just affter the at operator, as described by __stdcall decoration, suppose to indicate total size of the function arguments in bytes. The advapi32.lib file has the function arguments size of 40 bytes which is _CreateProcessWithLogonW@40 not 44.
I've used "sizeof" thing to sum the arguments size and it turned out to be 44 bytes not 40.
Out of curiousity, I've removed just the first argument off the function definition and it linked just fine, but when run, the exe broke down.
Now I'm out of ideas of how to squeeze 11 arguments into 40 bytes...
Thanks

Alex Blekhman

unread,
Apr 20, 2008, 4:22:44 PM4/20/08
to
"ILiya" wrote:
> I have no CreateProcessWithLogonW defined in my winbase.h file.

You need to update your Platform SDK. Hacking it with manual
declarations won't help. From your other post I assume that you
still use VC++6.0. The latest PSDK that is compatible with VC++6.0
is from February 2003.

http://www.qmedia.ca/launch/psdk.htm

HTH
Alex


ILiya

unread,
Apr 21, 2008, 2:09:28 AM4/21/08
to

"Alex Blekhman" <tkfx....@yahoo.com> wrote in message news:#Rk8ERyo...@TK2MSFTNGP05.phx.gbl...

!WHY! do I have to download whole psdk for just one function call??? btw when I used delphi, I didn't have any of those problems. where calling a function from unknown dll was a matter of single line code!

Alex Blekhman

unread,
Apr 21, 2008, 6:15:05 AM4/21/08
to
"ILiya" wrote:
>> You need to update your Platform SDK.
>>
>!WHY! do I have to download whole psdk for just one function
>call??? btw when I used delphi, I didn't have any of those
>problems. where calling a function from unknown dll was a matter
>of single line code!

Why? Because doing it the other way is error prone and not easy,
apparently. You say that your version of "advapi32.lib" expects 10
parameters for `CreateProcessWithLogonW'. You cannot just
"squeeze" additional parameters. Alternatively, load "advapi.dll"
via `LoadLibrary' call, then obtain the function's address with
`GetProcAddress'.

HTH
Alex


0 new messages