Using Win32 functions in Visual FoxPro Image Gallery
Process and Thread
..msdn
AssignProcessToJobObject
CommandLineToArgvW
CreateJobObject
CreateProcess
CreateProcessAsUser
CreateProcessWithLogonW
ExitProcess
FreeEnvironmentStrings
GetCommandLine
GetCurrentProcess
GetCurrentProcessId
GetCurrentThread
GetCurrentThreadId
GetEnvironmentStrings
GetEnvironmentVariable
GetPriorityClass
GetProcessIoCounters
GetProcessTimes
GetProcessVersion
GetStartupInfo
GetThreadPriority
IsWow64Process
OpenProcess
RegisterServiceProcess
SetEnvironmentVariable
SetPriorityClass
SetThreadPriority
Sleep
TerminateJobObject
TerminateProcess
WinExec
Code examples:
How to Start a Process as Another User (NT/XP/2K)
CreateProcessAsUser
..msdn    Add comment     W32 Constants      Translate this page
The CreateProcessAsUser function creates a new process and its primary thread. The new process then runs the specified executable file. The CreateProcessAsUser function is similar to the CreateProcess function, except that the new process runs in the security context of the user represented by the hToken parameter.
Code examples:
How to Start a Process as Another User (NT/XP/2K)
Declaration:
BOOL CreateProcessAsUser(
  HANDLE hToken,
  LPCTSTR lpApplicationName,
  LPTSTR lpCommandLine,
  LPSECURITY_ATTRIBUTES lpProcessAttributes,
  LPSECURITY_ATTRIBUTES lpThreadAttributes,
  BOOL bInheritHandles,
  DWORD dwCreationFlags,
  LPVOID lpEnvironment,
  LPCTSTR lpCurrentDirectory,
  LPSTARTUPINFO lpStartupInfo,
  LPPROCESS_INFORMATION lpProcessInformation
);

FoxPro declaration:
DECLARE INTEGER CreateProcessAsUser IN advapi32;
    INTEGER hToken,;
    STRING    lpApplicationName,;
    STRING    lpCommandLine,;
    INTEGER   lpProcessAttributes,;
    INTEGER   lpThreadAttributes,;
    INTEGER   bInheritHandles,;
    INTEGER   dwCreationFlags,;
    INTEGER   lpEnvironment,;
    STRING    lpCurrentDirectory,;
    STRING  @ lpStartupInfo,;
    STRING  @ lpProcessInformation

Parameters:
hToken
[in] Handle to a primary token that represents a user. The handle must have the TOKEN_QUERY, TOKEN_DUPLICATE, and TOKEN_ASSIGN_PRIMARY access rights.

lpApplicationName
[in] Pointer to a null-terminated string that specifies the module to execute.

lpCommandLine
[in] Pointer to a null-terminated string that specifies the command line to execute.

lpProcessAttributes
[in] Pointer to a SECURITY_ATTRIBUTES structure that specifies a security descriptor for the new process and determines whether child processes can inherit the returned handle.

lpThreadAttributes
[in] Pointer to a SECURITY_ATTRIBUTES structure that specifies a security descriptor for the new process and determines whether child processes can inherit the returned handle.

bInheritHandles
[in] If this parameter is TRUE, each inheritable handle in the calling process is inherited by the new process.

dwCreationFlags
[in] Flags that control the priority class and the creation of the process.

lpEnvironment
[in] Pointer to an environment block for the new process.

lpCurrentDirectory
[in] Pointer to a null-terminated string that specifies the current drive and directory for the new process.

lpStartupInfo
[in] Pointer to a STARTUPINFO structure that specifies the window station, desktop, standard handles, and appearance of the main window for the new process.

lpProcessInformation
[out] Pointer to a PROCESS_INFORMATION structure that receives identification information about the new process.
Return value:
If the function succeeds, the return value is nonzero.
My comment:
The CreateProcessWithLogonW and CreateProcessWithTokenW functions are similar to CreateProcessAsUser, except that the caller does not need to call the LogonUser function to authenticate the user and get a token.

This function is also similar to the SHCreateProcessAsUserW function.

Handles in PROCESS_INFORMATION must be closed with CloseHandle when they are no longer needed.
Word Index links for the CreateProcessAsUser :
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
Created: 2003-10-30 14:59:46
Modified: 2003-10-30 15:03:51
Visited in last 7 days: 30
User Contributed Notes:
There are no notes on this subject.


Copyright 2001-2017 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.37), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.196.8.177)
9 sec.Function: 'GetComputerObjectName'
20 sec.Function: 'FindClose'
32 sec.
Function group: 'Authorization'
45 sec.Function: 'AddClipboardFormatListener'
55 sec.Function: 'GetModuleFileName'
1.12 min.Function: 'GetCurrentThread'
1.28 min.
Function group: 'National Language Support'
1.45 min.Function: 'AppendMenu'
1.6 min.Function: 'CreateFileTransacted'
1.77 min.Function: 'CryptAcquireContext'
Google
Advertise here!