Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CreateProcessWithLogonW returns error
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
CreateProcessWithLogonW returns error
Miscellaneous
Thread ID:
00875077
Message ID:
00875077
Views:
98
It seems to always complain either about wrong path or file name.
What's the problem? Has anyone used it successfully from VFP? Works just fine from VB but I have to incorporate it into VFP...


DECLARE INTEGER CreateProcessWithLogonW IN AdvApi32 AS CrPr ;
STRING lpUserName, ;
STRING lpDomain, ;
STRING lpPassword, ;
INTEGER dwLogonFlags, ;
STRING lpAppName, ;
STRING lpCmdLine, ;
INTEGER dwCreationFlags, ;
INTEGER lpEnvir, ;
STRING lpCurDir, ;
STRING @ lpStartupInfo, ;
STRING @ lpProcessInfo

cUserName = "MyName"+CHR(0)
cDomain = "MyDomain"+CHR(0)
cPassword = "MyPassword"+CHR(0)
cAppName = "C:\\WINNT\\system32\\cmd.exe"+CHR(0)
cCmdLine=CHR(0)
cCurrDir=CHR(0) && current drive and directory of new process, if null, new process has same drive as system service that creates the process

*---- 16 bytes (4 * 4)
cProcessInfo = REPL(CHR(0),16) && Receives identification information for new process


*---- Normal
cStartupInfo = CHR(68) + ;
REPL(CHR(0),43) + ;
CHR(1) + ;
REPL(CHR(0),3)+ ;
CHR(1) + ;
REPL(CHR(0),19)

IF 0 = CrPr(cUserName, cDomain, cPassword, LOGON_NETCREDENTIALS_ONLY, cAppName, ;
cCmdLine, 0, ;
0, cCurrDir, @cStartupInfo, @cProcessInfo)

* FORMAT_MESSAGE_FROM_SYSTEM 0x1000
* LANG_NEUTRAL 0x0
.......
Next
Reply
Map
View

Click here to load this message in the networking platform