Kernel32GetCurrentDirectory Method

Retrieves the current directory for the current process.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", CharSet = CharSet.Auto, BestFitMapping = false, 
	ThrowOnUnmappableChar = true, SetLastError = true)]
public static uint GetCurrentDirectory(
	uint bufferLength,
	StringBuilder buffer
)

Parameters

bufferLength  UInt32
The length of the buffer for the current directory string, in TCHARs.

The buffer length must include room for a terminating null character.

buffer  StringBuilder
A pointer to the buffer that receives the current directory string. This null-terminated string specifies the absolute path to the current directory.

To determine the required buffer size, set this parameter to NULL and the bufferLength parameter to 0.

Return Value

UInt32
If the function succeeds, the return value specifies the number of characters that are written to the buffer, not including the terminating null character.

If the function fails, the return value is zero.

If the buffer that is pointed to by lpBuffer is not large enough, the return value specifies the required size of the buffer, in characters, including the null-terminating character.

Remarks

See Also