CreateDirectory function Null safety kernel32

int CreateDirectory (
  1. Pointer<Utf16> lpPathName,
  2. Pointer<SECURITY_ATTRIBUTES> lpSecurityAttributes
)

Creates a new directory. If the underlying file system supports security on files and directories, the function applies a specified security descriptor to the new directory.

BOOL CreateDirectoryW(
  LPCWSTR               lpPathName,
  LPSECURITY_ATTRIBUTES lpSecurityAttributes
);

Implementation

int CreateDirectory(Pointer<Utf16> lpPathName,
    Pointer<SECURITY_ATTRIBUTES> lpSecurityAttributes) {
  final _CreateDirectory = _kernel32.lookupFunction<
          Int32 Function(Pointer<Utf16> lpPathName,
              Pointer<SECURITY_ATTRIBUTES> lpSecurityAttributes),
          int Function(Pointer<Utf16> lpPathName,
              Pointer<SECURITY_ATTRIBUTES> lpSecurityAttributes)>(
      'CreateDirectoryW');
  return _CreateDirectory(lpPathName, lpSecurityAttributes);
}