STARTUPINFO
Item | Description |
Structure | STARTUPINFO. |
Info | Is used with the CreateProcess(), CreateProcessAsUser(), and CreateProcessWithLogonW() functions to specify the window station, desktop, standard handles, and appearance of the main window for the new process. |
Definition | typedef struct _STARTUPINFO { DWORD cb; LPTSTR lpReserved; LPTSTR lpDesktop; LPTSTR lpTitle; DWORD dwX; DWORD dwY; DWORD dwXSize; DWORD dwYSize; DWORD dwXCountChars; DWORD dwYCountChars; DWORD dwFillAttribute; DWORD dwFlags; WORD wShowWindow; WORD cbReserved2; LPBYTE lpReserved2; HANDLE hStdInput; HANDLE hStdOutput; HANDLE hStdError; } STARTUPINFO, *LPSTARTUPINFO; |
Members | See below. |
Header file | <windows.h> |
Remark | Declared as Unicode and ANSI structures. For graphical user interface (GUI) processes, this information affects the first window created by the CreateWindow() function and shown by the ShowWindow() function. For console processes, this information affects the console window if a new console is created for the process. A process can use the GetStartupInfo() function to retrieve the STARTUPINFO structure specified when the process was created. If a GUI process is being started and neither STARTF_FORCEONFEEDBACK or STARTF_FORCEOFFFEEDBACK is specified, the process feedback cursor is used. A GUI process is one whose subsystem is specified as "windows". |
Table 1. |
Members
cb - Size of the structure, in bytes. lpReserved - Reserved. Set this member to NULL before passing the structure to CreateProcess(). lpDesktop - Pointer to a null-terminated string that specifies either the name of the desktop or the name of both the desktop and window station for this process. A backslash in the string indicates that the string includes both the desktop and window station names. For CreateProcess() and CreateProcessAsUser(), if this member is NULL, the new process inherits the desktop and window station of its parent process. If this member is an empty string, the process does not inherit the desktop and window station of its parent process; instead, the system determines if a new desktop and window station need to be created. If the impersonated user already has a desktop, the system uses the existing desktop. For CreateProcessWithLogonW(), if this member is NULL or an empty string, the new process inherits the desktop and window station of its parent process. It is the responsibility of the application to add permission for the specified user account to the inherited window station and desktop, even for WinSta0\Default. Windows Me/98/95: Desktops and window stations are not supported. lpTitle - For console processes, this is the title displayed in the title bar if a new console window is created. If NULL, the name of the executable file is used as the window title instead. This parameter must be NULL for GUI or console processes that do not create a new console window. dwX - If dwFlags specifies STARTF_USEPOSITION, this member is the x offset of the upper left corner of a window if a new window is created, in pixels. Otherwise, this member is ignored. The offset is from the upper left corner of the screen. For GUI processes, the specified position is used the first time the new process calls CreateWindow() to create an overlapped window if the x parameter of CreateWindow() is CW_USEDEFAULT. dwY - If dwFlags specifies STARTF_USEPOSITION, this member is the y offset of the upper left corner of a window if a new window is created, in pixels. Otherwise, this member is ignored. The offset is from the upper left corner of the screen. For GUI processes, the specified position is used the first time the new process calls CreateWindow() to create an overlapped window if the y parameter of CreateWindow() is CW_USEDEFAULT. dwXSize - If dwFlags specifies STARTF_USESIZE, this member is the width of the window if a new window is created, in pixels. Otherwise, this member is ignored. For GUI processes, this is used only the first time the new process calls CreateWindow() to create an overlapped window if the nWidth parameter of CreateWindow() is CW_USEDEFAULT. dwYSize - If dwFlags specifies STARTF_USESIZE, this member is the height of the window if a new window is created, in pixels. Otherwise, this member is ignored. For GUI processes, this is used only the first time the new process calls CreateWindow() to create an overlapped window if the nHeight parameter of CreateWindow() is CW_USEDEFAULT. dwXCountChars - If dwFlags specifies STARTF_USECOUNTCHARS, if a new console window is created in a console process, this member specifies the screen buffer width, in character columns. Otherwise, this member is ignored. dwYCountChars - If dwFlags specifies STARTF_USECOUNTCHARS, if a new console window is created in a console process, this member specifies the screen buffer height, in character rows. Otherwise, this member is ignored. |
dwFillAttribute - If dwFlags specifies STARTF_USEFILLATTRIBUTE, this member is the initial text and background colors if a new console window is created in a console application. Otherwise, this member is ignored. This value can be any combination of the following values: FOREGROUND_BLUE, FOREGROUND_GREEN, FOREGROUND_RED, FOREGROUND_INTENSITY, BACKGROUND_BLUE, BACKGROUND_GREEN, BACKGROUND_RED, and BACKGROUND_INTENSITY. For example, the following combination of values produces red text on a white background:
FOREGROUND_RED | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE
dwFlags - Bit field that determines whether certain STARTUPINFO members are used when the process creates a window. This member can be one or more of the following values.
Value | Meaning |
STARTF_FORCEONFEEDBACK | Indicates that the cursor is in feedback mode for two seconds after CreateProcess() is called. The Working in Background cursor is displayed (see the Pointers tab in the Mouse control panel utility). If during those two seconds the process makes the first GUI call, the system gives five more seconds to the process. If during those five seconds the process shows a window, the system gives five more seconds to the process to finish drawing the window. The system turns the feedback cursor off after the first call to GetMessage(), regardless of whether the process is drawing. |
STARTF_FORCEOFFFEEDBACK | Indicates that the feedback cursor is forced off while the process is starting. The Normal Select cursor is displayed. |
STARTF_RUNFULLSCREEN | Indicates that the process should be run in full-screen mode, rather than in windowed mode. This flag is only valid for console applications running on an x86 computer. For Windows Me/98/95: This value is not supported. |
STARTF_USECOUNTCHARS | If this value is not specified, the dwXCountChars and dwYCountChars members are ignored. For Windows Me/98/95: This value is not supported. |
STARTF_USEFILLATTRIBUTE | If this value is not specified, the dwFillAttribute member is ignored. |
STARTF_USEPOSITION | If this value is not specified, the dwX and dwY members are ignored. |
STARTF_USESHOWWINDOW | If this value is not specified, the wShowWindow member is ignored. |
STARTF_USESIZE | If this value is not specified, the dwXSize and dwYSize members are ignored. |
STARTF_USESTDHANDLES | Sets the standard input, standard output, and standard error handles for the process to the handles specified in the hStdInput, hStdOutput, and hStdError members of the STARTUPINFO structure. For this to work properly, the handles must be inheritable and the CreateProcess function's bInheritHandles parameter must be set to TRUE. If this value is not specified, the hStdInput, hStdOutput, and hStdError members of the STARTUPINFO structure are ignored. |
Table 2 |
wShowWindow - If dwFlags specifies STARTF_USESHOWWINDOW, this member can be any of the SW_ constants defined in Winuser.h. Otherwise, this member is ignored. For GUI processes, wShowWindow specifies the default value the first time ShowWindow() is called. The nCmdShow parameter of ShowWindow() is ignored. In subsequent calls to ShowWindow(), the wShowWindow member is used if the nCmdShow parameter of ShowWindow() is set to SW_SHOWDEFAULT.
cbReserved2 - Reserved for use by the C Runtime; must be zero.
lpReserved2 - Reserved for use by the C Runtime; must be NULL.
hStdInput - If dwFlags specifies STARTF_USESTDHANDLES, this member is a handle to be used as the standard input handle for the process. Otherwise, this member is ignored.
hStdOutput - If dwFlags specifies STARTF_USESTDHANDLES, this member is a handle to be used as the standard output handle for the process. Otherwise, this member is ignored.
hStdError - If dwFlags specifies STARTF_USESTDHANDLES, this member is a handle to be used as the standard error handle for the process. Otherwise, this member is ignored.
PROCESS_INFORMATION
Item | Description |
Structure | PROCESS_INFORMATION. |
Info | Is filled in by either the CreateProcess(), CreateProcessAsUser(), CreateProcessWithLogonW(), or CreateProcessWithTokenW() function with information about the newly created process and its primary thread. |
Definition | typedef struct _PROCESS_INFORMATION { HANDLE hProcess; HANDLE hThread; DWORD dwProcessId; DWORD dwThreadId; } PROCESS_INFORMATION; |
Members | hProcess - Handle to the newly created process. The handle is used to specify the process in all functions that perform operations on the process object. hThread - Handle to the primary thread of the newly created process. The handle is used to specify the thread in all functions that perform operations on the thread object. dwProcessId - Value that can be used to identify a process. The value is valid from the time the process is created until the time the process is terminated. dwThreadId - Value that can be used to identify a thread. The value is valid from the time the thread is created until the time the thread is terminated. |
Header file | <windows.h> |
Remark | If the function succeeds, be sure to call the CloseHandle() function to close the hProcess and hThread handles when you are finished with them. Otherwise, when the child process exits, the system cannot clean up these handles because the parent process did not close them. However, the system will close these handles when the parent process terminates, so they would be cleaned up at this point. |
Table 3. |
SECURITY_ATTRIBUTES
Item | Description |
Structure | SECURITY_ATTRIBUTES. |
Info | Contains the security descriptor for an object and specifies whether the handle retrieved by specifying this structure is inheritable. This structure provides security settings for objects created by various functions, such as CreateFile(), CreatePipe(), CreateProcess(), RegCreateKeyEx(), or RegSaveKeyEx(). |
Definition | typedef struct _SECURITY_ATTRIBUTES { DWORD nLength; LPVOID lpSecurityDescriptor; BOOL bInheritHandle; } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES; |
Members | nLength - Specifies the size, in bytes, of this structure. Set this value to the size of the SECURITY_ATTRIBUTES structure. lpSecurityDescriptor - Pointer to a security descriptor for the object that controls the sharing of it. If NULL is specified for this member, the object is assigned the default security descriptor of the calling process. This is not the same as granting access to everyone by assigning a NULL DACL. The default security descriptor is based on the default DACL of the access token belonging to the calling process. By default, the default DACL in the access token of a process allows access only to the user represented by the access token. If other users must access the object, you can either create a security descriptor with the appropriate access, or add ACEs to the DACL that grants access to a group of users. For Windows 95/98/Me: The lpSecurityDescriptor member of this structure is ignored. bInheritHandle - Specifies whether the returned handle is inherited when a new process is created. If this member is TRUE, the new process inherits the handle. |
Header file | <windows.h> |
Remark | - |
Table 4. |
GENERIC_MAPPING
Item | Description |
Structure | GENERIC_MAPPING. |
Info | Defines the mapping of generic access rights to specific and standard access rights for an object. When a client application requests generic access to an object, that request is mapped to the access rights defined in this structure. |
Definition | typedef struct _GENERIC_MAPPING { ACCESS_MASK GenericRead; ACCESS_MASK GenericWrite; ACCESS_MASK GenericExecute; ACCESS_MASK GenericAll; } GENERIC_MAPPING; |
Members | GenericRead - Specifies an access mask defining read access to an object. GenericWrite - Specifies an access mask defining write access to an object. GenericExecute - Specifies an access mask defining execute access to an object. GenericAll - Specifies an access mask defining all possible types of access to an object. |
Header file | <windows.h> |
Remark | - |
Table 5. |
PRIVILEGE_SET
Item | Description |
Structure | PRIVILEGE_SET. |
Info | Specifies a set of privileges. It is also used to indicate which, if any, privileges are held by a user or group requesting access to an object. |
Definition | typedef struct _PRIVILEGE_SET { DWORD PrivilegeCount; DWORD Control; LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY]; } PRIVILEGE_SET, *PPRIVILEGE_SET; |
Members | PrivilegeCount - Specifies the number of privileges in the privilege set. Control - Specifies a control flag related to the privileges. The PRIVILEGE_SET_ALL_NECESSARY control flag is currently defined. It indicates that all of the specified privileges must be held by the process requesting access. If this flag is not set, the presence of any privileges in the user's access token grants the access. Privilege - Specifies an array of LUID_AND_ATTRIBUTES structures describing the set's privileges. The following attributes are defined for privileges:
|
Header file | <windows.h> |
Remark | A privilege is used to control access to an object or service more strictly than is typical with discretionary access control. A system manager uses privileges to control which users are able to manipulate system resources. An application uses privileges when it changes a system-wide resource, such as when it changes the system time or shuts down the system. |
Table 6. |
LUID_AND_ATTRIBUTES
Item | Description |
Structure | LUID_AND_ATTRIBUTES. |
Info | Represents a locally unique identifier (LUID) and its attributes. |
Definition | typedef struct _LUID_AND_ATTRIBUTES { LUID Luid; DWORD Attributes; } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES; |
Members | Luid - Specifies an LUID value. Attributes - Specifies attributes of the LUID. This value contains up to 32 one-bit flags. Its meaning is dependent on the definition and use of the LUID. |
Header file | <windows.h> |
Remark | An LUID_AND_ATTRIBUTES structure can represent an LUID whose attributes change frequently, such as when the LUID is used to represent privileges in the PRIVILEGE_SET structure. Privileges are represented by LUIDs and have attributes indicating whether they are currently enabled or disabled. |
Table 7. |
LUID
Item | Description |
Structure | LUID. |
Info | Is a 64-bit value guaranteed to be unique only on the system on which it was generated. The uniqueness of a locally unique identifier (LUID) is guaranteed only until the system is restarted. An LUID is not for direct manipulation. Applications are to use functions and structures to manipulate LUID values. |
Definition | typedef struct _LUID { DWORD LowPart; LONG HighPart; } LUID, *PLUID; |
Members | LowPart - Low order bits. HighPart - High order bits. |
Header file | <windows.h> |
Remark | - |
Table 8. |
SECURITY_DESCRIPTOR
Item | Description |
Structure | SECURITY_DESCRIPTOR. |
Info | Contains the security information associated with an object. Applications use this structure to set and query an object's security status. Because the internal format of a security descriptor can vary, applications are not to modify the SECURITY_DESCRIPTOR structure directly. |
Definition | typedef struct SECURITY_DESCRIPTOR { ... } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR, PSECURITY_DESCRIPTOR; |
Members | User defined. |
Header file | <windows.h> |
Remark | A security descriptor includes information that specifies the following components of an object's security:
Several functions that use the SECURITY_DESCRIPTOR structure require that this structure be on a valid pointer boundary in memory. These boundaries vary depending on the type of processor used. Memory allocation functions, such as malloc and LocalAlloc(), return properly aligned pointers. |
Table 9. |
Item | Description |
Structure | THREADENTRY32. |
Info | Describes an entry from a list that enumerates the threads executing in the system when a snapshot was taken. |
Definition | typedef struct tagTHREADENTRY32 { DWORD dwSize; DWORD cntUsage; DWORD th32ThreadID; DWORD th32OwnerProcessID; LONG tpBasePri; LONG tpDeltaPri; DWORD dwFlags; } THREADENTRY32, *PTHREADENTRY32; |
Members | See below. |
Header file | <tlhelp32.h> |
Remark | - |
Table 10. |
Members
dwSize - Size of the structure, in bytes. Before calling the Thread32First() function, set this member to sizeof(THREADENTRY32). If you do not initialize dwSize, Thread32First() fails.
cntUsage - This member is no longer used and is always set to zero.
th32ThreadID - Win32 thread identifier, compatible with the thread identifier returned by the CreateProcess() function.
th32OwnerProcessID - Identifier of the process that created the thread.
tpBasePri - Initial priority level assigned to a thread. This member can be one of the following values (defined in winbase.h and winnt.h):
Value | Meaning |
THREAD_PRIORITY_IDLE | Indicates a base priority level of 1 for IDLE_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASS processes, and a base priority level of 16 for REALTIME_PRIORITY_CLASS processes. |
THREAD_PRIORITY_LOWEST | Indicates 2 points below normal priority for the priority class. |
THREAD_PRIORITY_BELOW_NORMAL | Indicates one point below normal priority for the priority class. |
THREAD_PRIORITY_NORMAL | Indicates normal priority for the priority class. |
THREAD_PRIORITY_ABOVE_NORMAL | Indicates one point above normal priority for the priority class. |
THREAD_PRIORITY_HIGHEST | Indicates two points above normal priority for the priority class. |
THREAD_PRIORITY_TIME_CRITICAL | Indicates a base priority level of 15 for IDLE_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASS processes, and a base priority level of 31 for REALTIME_PRIORITY_CLASS processes. |
Table 11 |
tpDeltaPri - This member is no longer used and is always set to zero.
dwFlags - This member is no longer used and is always set to zero.
Item | Description |
Structure | PROCESSENTRY32. |
Info | Describes an entry from a list that enumerates the processes residing in the system address space when a snapshot was taken. |
Definition | typedef struct tagPROCESSENTRY32 { DWORD dwSize; DWORD cntUsage; DWORD th32ProcessID; ULONG_PTR th32DefaultHeapID; DWORD th32ModuleID; DWORD cntThreads; DWORD th32ParentProcessID; LONG pcPriClassBase; DWORD dwFlags; TCHAR szExeFile[MAX_PATH]; } PROCESSENTRY32, *PPROCESSENTRY32; |
Members | dwSize - Size of the structure, in bytes. Before calling the Process32First() function, set this member to sizeof(PROCESSENTRY32). If you do not initialize dwSize, Process32First() fails. cntUsage - This member is no longer used and is always set to zero. th32ProcessID - Process identifier. th32DefaultHeapID - This member is no longer used and is always set to zero. th32ModuleID - This member is no longer used and is always set to zero. cntThreads - Number of execution threads started by the process. th32ParentProcessID - Process identifier of the process that created this process (its parent process). pcPriClassBase - Base priority of any threads created by this process. dwFlags - This member is no longer used, and is always set to zero. szExeFile - Pointer to a null-terminated string that specifies the name of the executable file for the process. |
Header file | <tlhelp32.h> |
Remark | - |
Item | Description |
Structure | MODULEENTRY32. |
Info | Describes an entry from a list that enumerates the modules used by a specified process. |
Definition | typedef struct tagMODULEENTRY32 { DWORD dwSize; DWORD th32ModuleID; DWORD th32ProcessID; DWORD GlblcntUsage; DWORD ProccntUsage; BYTE* modBaseAddr; DWORD modBaseSize; HMODULE hModule; TCHAR szModule[MAX_MODULE_NAME32 + 1]; TCHAR szExePath[MAX_PATH]; } MODULEENTRY32, *PMODULEENTRY32; |
Members | dwSize - Size of the structure, in bytes. Before calling the Module32First() function, set this member to sizeof(MODULEENTRY32). If you do not initialize dwSize, Module32First() fails. th32ModuleID - This member is no longer used, and is always set to one. th32ProcessID - Win32 process identifier of the process whose modules are to be examined. GlblcntUsage - The load count of the module, which is not generally meaningful, and usually equal to 0xFFFF. ProccntUsage - Same as GlblcntUsage: the load count of the module, which is not generally meaningful, and usually equal to 0xFFFF. modBaseAddr - Base address of the module in the context of the owning process. modBaseSize - Size of the module, in bytes. hModule - Handle to the module in the context of the owning process. szModule - Pointer to a null-terminated string that specifies the module name. szExePath - Pointer to a null-terminated string that specifies the module path. |
Header file | <tlhelp32.h> |
Remark | The modBaseAddr and hModule members are valid only in the context of the process specified by th32ProcessID. |
Table 13. |
Item | Description |
Structure | OVERLAPPED. |
Info | Contains information used in asynchronous input and output (I/O). |
Definition | typedef struct _OVERLAPPED { ULONG_PTR Internal; ULONG_PTR InternalHigh; DWORD Offset; DWORD OffsetHigh; HANDLE hEvent; } OVERLAPPED; |
Members | Internal - Reserved for operating system use. This member, which specifies a system-dependent status, is valid when the GetOverlappedResult() function returns without setting the extended error information to ERROR_IO_PENDING. InternalHigh - Reserved for operating system use. This member, which specifies the length of the data transferred, is valid when the GetOverlappedResult() function returns TRUE. Offset - File position at which to start the transfer. The file position is a byte offset from the start of the file. The calling process sets this member before calling the ReadFile() or WriteFile() function. sThis member is ignored when reading from or writing to named pipes and during serial communication and should be zero. OffsetHigh - High-order word of the byte offset at which to start the transfer. This member is ignored when reading from or writing to named pipes and communications devices and should be zero. hEvent - Handle to an event set to the signaled state when the operation has been completed. The calling process must set this member either to zero or a valid event handle before calling any overlapped functions. To create an event object, use the CreateEvent() function. Some of the functions used with overlapped I/O (such as GetOverlappedResult()) may wait on this handle. Therefore, if you use an automatic reset event, your application can hang if such a function is already waiting on the handle when you begin to wait on it. Functions such as WriteFile() set the event to the non-signaled state before they begin an I/O operation. |
Header file | <windows.h> |
Remark | This structure should always be initialized to zero before it is used in a function call. If it is not, the function may fail and return ERROR_INVALID_PARAMETER. You can use the HasOverlappedIoCompleted() macro to determine whether an asynchronous I/O operation has completed. You can use the CancelIo function to cancel an asynchronous I/O operation. |
Table 14. |
Item | Description |
Structure | SLIST_ENTRY. |
Info | Represents an item in a singly linked list. |
Definition | typedef struct _SLIST_ENTRY { struct _SLIST_ENTRY* Next; } SLIST_ENTRY, *PSLIST_ENTRY; |
Members | Next - Pointer to an SLIST_ENTRY structure that represents the next item in a singly linked list. |
Header file | <windows.h> |
Remark | - |
Table 15. |
Item | Description |
Structure | MSG. |
Info | Contains message information from a thread's message queue. |
Definition | typedef struct { HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; DWORD time; POINT pt; } MSG, *PMSG; |
Members | hwnd - Handle to the window whose window procedure receives the message. message - Specifies the message identifier. Applications can only use the low word; the high word is reserved by the system. wParam - Specifies additional information about the message. The exact meaning depends on the value of the message member. lParam - Specifies additional information about the message. The exact meaning depends on the value of the message member. time - Specifies the time at which the message was posted. pt - Specifies the cursor position, in screen coordinates, when the message was posted. |
Header file | <windows.h> |
Remark | - |
Table 16. |
---------------------------------------------End Structures------------------------------------------
Further reading and digging:
Microsoft Visual C++, online MSDN.
Structure, enum, union and typedef story can be found at C enum, typedef, define etc..
For Multi-bytes, Unicode characters and Localization please refer to Unicode & Multi byte 1 (Story) and Unicode & Multi-byte 2 (Implementation).
Windows data type information is in Windows data type.
Check the best selling C / C++ and Windows books at Amazon.com.