dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: How to use CreateProcessWithLogonW

  1. #1
    Join Date
    Nov 2001
    Location
    Nigeria
    Posts
    12

    How to use CreateProcessWithLogonW

    I have been trying to get my code to log on as another user and start a process on the local computer "ROUGHRIDER8" using another local users credentials "oluwaseun/oluwaseun".
    My code generates error 87 i.e. The parameter is incorrect. ERROR_INVALID_PARAMETER
    Can anyone offer code that works or any guideline on this new SDK API. My Operating system is Windows 2000 using Visual C++ 6.0 SP4
    Cheers
    Gbola
    Code
    BOOL ki=CreateProcessWithLogonW(
    L"oluwaseun", // user's name
    L"ROUGHRIDER8", // user's domain
    L"oluwaseun", // user's password
    CREATE_DEFAULT_ERROR_MODE+CREATE_NEW_CONSOLE+CREATE_NEW_PROCESS_GROUP,//LOGON_NETCREDENTIALS_ONLY, // logon option
    (LPCWSTR)&jola[0], // executable module name
    NULL, // command-line string
    NORMAL_PRIORITY_CLASS, // creation flags
    NULL, // new environment block
    L"c:\\", // current directory name
    NULL, // startup information
    &procinfo // process information
    );

  2. #2
    Join Date
    Dec 2002
    Posts
    287
    You have to use OR to combine flags:

    CREATE_DEFAULT_ERROR_MODE+CREATE_NEW_CONSOLE+CREATE_NEW_PROCESS_GROUP

    should be changed to:

    CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP

    Also make sure the jola variable is declared a WCHAR not char (you didn't provide us the declaration of this variable)


    Dan

  3. #3
    Join Date
    May 2002
    Location
    India
    Posts
    268

    Question How to logon to a remote machine on the LAN and start a process?

    Hi folks,
    I am currently facing the problem as specified in the topic question. All I need to do is logon to a remote machine in the LAN and start an executable. The catch is I cannot use sockets. CreateProcessWithLogonW allows me to logon to the domain on my own machine using a different user id and password but how to achieve the same on a remote machine. Is it possible? If yes, kindly guide me.
    ciao.
    Life is short, enjoy it with a smile as long as it lasts.
    User error. Replace User and press any key when ready. - Anonymous

  4. #4
    Join Date
    Jan 2001
    Posts
    588
    I don't believe that's possible. If you want to logon to another machine, you'll have to use some sort of socket to communicate with it at some point. Why aren't you allowed to use sockets?

  5. #5
    Join Date
    May 2002
    Location
    India
    Posts
    268

    Coz the client says so

    Hi mate,
    I actually need to do this for our client. And he does not want us to use sockets. Guess will have to talk to the client. Will try to update regularly.
    ciao
    Life is short, enjoy it with a smile as long as it lasts.
    User error. Replace User and press any key when ready. - Anonymous

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)