C++: Enumerating Environment
Objective
Enumerate username, computername and current working directory.
To do list
Create a class and enumerate specified information.
Functions
GetUserName: Enumerate current username.
Definition: GetUserName(LPSTR lpBuffer, LPDWORD pcbBuffer)
lpBuffer: Buffer to hold username string. TCHAR userName[ULEN + 1]
pcbBuffer: Pointer to buffer size. DWORD bufCharCount
GetComputerName: Enumerate current computername.
Definition: GetComputerName(LPSTR lpBuffer, LPDWORD
lpBuffer: Buffer to hold computername string. TCHAR computerName[ULEN + 1]
pcbBuffer: Pointer to buffer size. DWORD bufCharCount
GetCurrentDirectoryA: Enumerate current working directory.
Definition: GetCurrentDirectoryA(DWORD nBufferLength, LPSTR lpBuffer)
nBufferLength: Size of buffer. ULEN + 1
buffer: Buffer to hold directory string. TCHAR currentDirectory[ULEN + 1]
Application (enum-env.cpp)
References:
Last updated
Was this helpful?