Windows: Exitprocess Is The Preferred Method of Ending A Process. This
Windows: Exitprocess Is The Preferred Method of Ending A Process. This
Windows: Exitprocess Is The Preferred Method of Ending A Process. This
When a thread calls CreateProcess, the system creates a process kernel object with an initial usage
count of 1. This process kernel object is not the process itself but a small data structure that the
operating system uses to manage the process—you can think of the process kernel object as a small
data structure that consists of statistical information about the process. The system then creates a
virtual address space for the new process and loads the code and data for the executable file and any
required DLLs into the process's address space.
The system then creates a thread kernel object (with a usage count of 1) for the new process's
primary thread. Like the process kernel object, the thread kernel object is a small data structure that
the operating system uses to manage the thread. This primary thread begins by executing the C/C++
run-time startup code, which eventually calls your WinMain, wWinMain, main, or wmain function.
If the system successfully creates the new process and primary thread, CreateProcess returns
TRUE.
HANDLE CreateFile(
LPCTSTR lpFileName, // pointer to name of the file
DWORD dwDesiredAccess, // access (read-write) mode
DWORD dwShareMode, // share mode
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
// pointer to security attributes
DWORD dwCreationDisposition, // how to create
DWORD dwFlagsAndAttributes, // file attributes
HANDLE hTemplateFile // handle to file with attributes
to
// copy
);
Creates or opens a file or I/O device. The most commonly used I/O devices are
as follows: file, file stream, directory, physical disk, volume, console buffer,
tape drive, communications resource, mailslot, and pipe. The function returns a
handle that can be used to access the file or device for various types of I/O
depending on the file or device and the flags and attributes specified.
BOOL ReadFile(
HANDLE hFile,
LPVOID lpBuffer,
DWORD nNumberOfBytesToRead,
LPDWORD lpNumberOfBytesRead,
LPOVERLAPPED lpOverlapped
);
ReadConsole reads keyboard input from a console's input buffer. It behaves like
the ReadFile function, except that it can read in either Unicode (wide-
character) or ANSI mode. To have applications that maintain a single set of
sources compatible with both modes, use ReadConsole rather than ReadFile.
Although ReadConsole can only be used with a console input buffer handle,
ReadFile can be used with other handles (such as files or pipes). ReadConsole
fails if used with a standard handle that has been redirected to be something
other than a console handle.
DWORD GetCurrentProcessId();
UINT_PTR SetTimer(
HWND hWnd,
UINT_PTR nIDEvent,
UINT uElapse,
TIMERPROC lpTimerFunc
);
Type: UINT_PTR
If the function succeeds and the hWnd parameter is NULL, the return value is an integer identifying
the new timer.If the function succeeds and the hWnd parameter is not NULL, then the return value
is a nonzero integer.Creates a timer with the specified time-out value.An application can process
WM_TIMER messages by including a WM_TIMER case statement in the window procedure or by
specifying a TimerProc callback function when creating the timer.
BOOL CreatePipe(
PHANDLE hReadPipe,
PHANDLE hWritePipe,
LPSECURITY_ATTRIBUTES lpPipeAttributes,
DWORD nSize
);
If the function succeeds, the return value is nonzero.If the function fails, the return value is
zero.Creates an anonymous pipe, and returns handles to the read and write ends of the
pipe.CreatePipe creates the pipe, assigning the specified pipe size to the storage buffer. CreatePipe
also creates handles that the process uses to read from and write to the buffer.
LPVOID MapViewOfFile(
HANDLE hFileMappingObject,
DWORD dwDesiredAccess,
DWORD dwFileOffsetHigh,
DWORD dwFileOffsetLow,
SIZE_T dwNumberOfBytesToMap
);
HANDLE CreateFileMappingA(
HANDLE hFile,
LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
DWORD flProtect,
DWORD dwMaximumSizeHigh,
DWORD dwMaximumSizeLow,
LPCSTR lpName
);
If the function succeeds, the return value is a handle to the newly created file mapping object.If the
function fails, the return value is NULL.Creates or opens a named or unnamed file mapping object
for a specified file.After a file mapping object is created, the size of the file must not exceed the size
of the file mapping object; if it does, not all of the file contents are available for sharing.
BOOL SetFileSecurityA(
LPCSTR lpFileName,
SECURITY_INFORMATION SecurityInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor
);
If the function succeeds, the function returns nonzero.If the function fails, it
returns zero. The SetFileSecurity function sets the security of a file or directory object.
BOOL InitializeSecurityDescriptor(
PSECURITY_DESCRIPTOR pSecurityDescriptor,
DWORD dwRevision
);
uint32 SetSecurityDescriptor(
Descriptor [in]
The SetSecurityDescriptorWMI class method sets a security descriptor to the specified structure. A
security descriptor contains information about the owner of the object and the object's primary
group. The security descriptor also contains the discretionary access control list (DACL) and the
system access control list (SACL). DACLs specify which groups and accounts have access to an
object and what type of access to grant. SACLs specify who has access to the auditing entries in the
Security event log.