LogonUser with executing a batch script via cmd.exe

Archived from groups: comp.os.ms-windows.programmer.win32,comp.lang.basic.visual.misc,microsoft.public.windowsnt.misc,comp.os.ms-windows.nt.software.services (More info?)

Hi,
In my program which is launched via a modified msgina (and hence runs
as SYSTEM), I do the following

1. LogonUser
2. ImpersonateUser
3. CreateProcessAsUser (with the security token obtained via
LogonUser)

For the CreateProcessAsUser, I execute cmd.exe and pass in a batch
file to run which mounts drives via "net use".

The drives mount fine, however, the drives are ONLY AVAILABLE to that
cmd window. Any other process (like explorer or some other cmd shell)
cannot see those drives

Any clues?

Thanks
Lyle
1 answer Last reply
More about logonuser executing batch script
  1. Archived from groups: comp.os.ms-windows.programmer.win32,comp.lang.basic.visual.misc,microsoft.public.windowsnt.misc,comp.os.ms-windows.nt.software.services (More info?)

    "Lyle Coder" <x_coder@hotmail.com> wrote in message
    news:49fdc875.0410052204.2bbc5716@posting.google.com...
    > Hi,
    > In my program which is launched via a modified msgina (and hence runs
    > as SYSTEM), I do the following
    >
    > 1. LogonUser
    > 2. ImpersonateUser
    > 3. CreateProcessAsUser (with the security token obtained via
    > LogonUser)
    >
    > For the CreateProcessAsUser, I execute cmd.exe and pass in a batch
    > file to run which mounts drives via "net use".
    >
    > The drives mount fine, however, the drives are ONLY AVAILABLE to that
    > cmd window. Any other process (like explorer or some other cmd shell)
    > cannot see those drives

    Virtual drives (made by Net use) are stored in Registry under
    HKEY_CURRENT_USER.
    When your code runs there is no such hive loaded as SYSTEM doesn't have one
    and the
    API's you specify doesn't load one.
    Anyway.. to give permission to network drives to a specific user you a) need
    the users
    account credentials and b) need to store the account etc in his/her Registry
    hive. Thus
    i can't see the point in your excersise - why not just use a logon script, a
    shortcut in
    All Users\... Startup or a command line under Run in HKLM ?

    - Sten
Ask a new question

Read More

Command Prompt Microsoft Windows