DefineDosDevice function kernel32

Win32Result<bool> DefineDosDevice(
  1. DEFINE_DOS_DEVICE_FLAGS dwFlags,
  2. PCWSTR lpDeviceName,
  3. PCWSTR? lpTargetPath
)

Defines, redefines, or deletes MS-DOS device names.

To learn more, see learn.microsoft.com/windows/win32/api/fileapi/nf-fileapi-definedosdevicew.

Implementation

Win32Result<bool> DefineDosDevice(
  DEFINE_DOS_DEVICE_FLAGS dwFlags,
  PCWSTR lpDeviceName,
  PCWSTR? lpTargetPath,
) {
  resolveGetLastError();
  final result_ = _DefineDosDevice(
    dwFlags,
    lpDeviceName,
    lpTargetPath ?? nullptr,
  );
  return .new(value: result_ != FALSE, error: GetLastError());
}