# Win32

NetApp storage systems emulate Windows servers by implementing the underlying management remote procedure call (RPC). Additionally, the redirector on Windows CIFS clients translates many Win32 API calls, such as _mkdir(), WriteFile(), CreateDirectory(), and so on, into SMB requests, which are handled by the CIFS protocol code on the storage system. The SDK includes a list of Win32 APIs supported by NetApp storage systems.

The following Win32 API calls are supported on NetApp storage systems running CIFS.

The authoritative source of information for every routine mentioned are is the MSDN article pertaining to that routine. Failure of the storage system to obey the semantics given in Microsoft's documentation should be reported.

## File I/O calls

### Win32 routines:

Native Win32 calls

CreateFile | Open (or create) a file.
CreateFileForMapping | Open a file for memory mapping. This call looks to the server like CreateFile(); the client does the memory mapping. There are numerous other routines related to memory mapping not listed here.
CloseHandle | Close a stream.
CopyFile | Copy a file.
CopyFileEx | Extended copy.
CreateDirectory | Create a directory.
CreateDirectoryEx | Extended directory create.
DeleteFile | Delete a file.
FlushFileBuffers | Flush a file's memory buffers to disk.
GetDiskFreeSpace | Get information about a logical drive, which might be a network drive mounted on a remote server.
GetDiskFreeSpaceEx | -
GetFileAttributes | Get file attributes.
GetFileAttributesEx | -
GetFileInformationByHandle | Get information about a file from its HANDLE.
GetFileSecurity | Get NT file permissions (ACEs on an ACL; that is, Access Control Entries on an Access Control List).
GetFileSize | Get the size of a file.
GetFileSizeEx | -
LockFile | Lock a range or all of a file .
LockFileEx | -
MoveFile | Move a file from one place to another, swapping pointers if possible and copying if necessary.
MoveFileEx |
MoveFileWithProgress | The client does the progress indication based on the write size and what GetFileSize() says the amount to be written is.
ReadDirectoryChangesW | Set change-notify status on a directory.
ReadFile | Read part or all of a file.
ReadFileEx | -
ReadFileScatter | -
RemoveDirectory | Remove an empty directory.
ReplaceFile | Replace one file with another, possibly backing up the replaced file first.
SetEndOfFile | Truncate or (possibly sparsely) extend a file.
SetFileAttributes | Set file attributes using setattr.
SetFileSecurity | Set NT file permissions (ACEs on an ACL;that is Access Control Entries on an Access Control List).
SetFileShortName | Set the DOS 8.3 name of a file.
UnlockFile | Unlock a byte range or whole file lock.
UnlockFileEx | -
WriteFile | Write to a file.
WriteFileEx | -
WriteFileGather | -

###

### FILE* routines:

ANSI calls FILE*S "streams". This is not the same as NTFS streams, although an NTFS stream can be opened as an ANSI stream by using <filename>:<streamname> notation.

fopen | _tfopen | _wfopen | Open (or create) a file.
freopen | _tfreopen | _wfreopen | Reassign a file pointer.
fclose | _tfclose | _wfclose | Close a stream.
_fcloseall | - | - | Close all open streams.
| _tfdopen | _wfdopen | Associate a stream with a file that was previously opened for low-level I/O.
fsetpos | - | - | Set the stream-position indicator.
fread | - | - | Read data from a stream (an ANSI stream or a FILE*, but not an NTFS stream).
fwrite | - | - | Write data to a stream.
fgetc | _fgettc | fgetwc | Get a character from a stream.
fputc | _fputtc | fputwc | Put a character to a stream.
fgets | _fgetts | fgetws | Get a string from a stream.
rewind |  |  | Reset the file pointer to the beginning of the file.
fprintf | _ftprintf | fwprintf | Formatted print to file.
vfprintf | _vftprintf | vfwprintf | Formatted print to file using the varargs list.
fflush | - | - | Flush stream buffers to file.
_flushall | - | - | Flush all open streams.
fseek | - | - | Set a file pointer to a specified position.
_fdopen | _tfdopen | _wfdopen | Associate a stream with a file previously opened for low-level I/O.
_popen | _tpopen | _wpopen | Open a pipe.
_sopen | _tsopen | _wsopen | Open a file for sharing.
_fsopen | _tfsopen | _wfsopen | Open a stream for sharing.

Filehandle routines:

_creat _tcreat _wcreat | Create a file.
_read | Read from a file.
_write | Write to a file.
_close | Close a file.
_lseek | Seek to a specified offset.
_lseeki64 | Seek to a 64-bit offset.
_tell | Get current file offset.
_telli64 | Get offset as a 64-bit integer (__int64).
_filelength | Get length of file.
_filelengthi64 | Get length of file as a 64-bit integer.
_fstat | Get stat information about file.
_fstat64 | ""
_fstati64 | ""
_fstati64 | Truncate file, or extend and pad it with zeroes.

File management routines:

_mkdir | _tmkdir | __wmkdir | Create a directory.
_rmdir | _trmdir | _wrmdir | Read from a directory.
rename | _trename | _wrename | Rename a file or directory.
_unlink | _tunlink | _wunlink | Delete a file.
remove | _tremove | _wremove | Delete a file.
_stat | _tstat | _wstat | Get file stats.
_stat64 | _tstat64 | _wstat64 | ""
_stati64 | _tstati64 | _wstati64 | ""
_access | _taccess | _waccess | Set POSIX file permissions.
chmod | _tchmod | _wchmod | Set POSIX file permissions.

Search routines:

FindFirstFile | - | - | Find a file using a possibly wildcard pattern.
FindFirstFileEx | - | - | Search on attributes as well as file name.
FindNextFile | - | - | Continue a file search.
FindClose | - | - | Release buffers used by FindFirst and FindNext.
_findfirst | _tfindfirst | _wfindfirst | Similar to FindFirstFile.
_findfirst64 | _tfindfirst64 | _wfindfirst64 | 64-bit version.
_findfirsti64 | _tfindfirsti64 | _wfindfirsti64 | Another 64-bit version.
_findnext | _tfindnext | _wfindnext | Similar to FindNextFile.
findnext64 | _tfindnext64 | _wfindnext64 | 64-bit version.
_findnexti64 | _tfindnexti64 | _wfindnexti64 | Another 64-bit version.
_findclose | - | - | -

Miscellaneous routines:

_pipe | Set up a pair of pipes for reading and writing (used prior to forking).
_getdiskfree | Get freespace information for a logical drive.

Obsolete routines:

These routines are used for backward compatibility with Win16 clients.

_hread
_hwrite
_lclose
_lcreat
_lfind
_llseek
_lopen
_lread
_lwrite
OpenFile

## LSA calls

LsaClose
LsaOpenPolicy
LsaQueryInformationPolicy
LsaEnumerateTrustedDomains
LsaLookupNames
LsaLookupSids
LsaEnumerateAccountRights
LsaOpenPolicy
LsaGetUserName

## Print Spooling calls

OpenPrinter | The storage system returns NULL here, signifying that it doesn't have any printers.

## Network management calls

NetConnectionEnum
NetFileEnum
NetFileGetInfo
NetFileClose
NetSessionEnum
NetSessionDel
NetShareAdd
NetShareEnum
NetShareGetInfo
NetShareSetInfo
NetShareDel
NetServerGetInfo
NetServerSetInfo
NetServerDiskEnum
NetServerTransportAdd
NetServerTransportEnum
NetServerTransportDel
NetRemoteTOD
NetValidateName

## Local groups

NetLocalGroupEnum
NetLocalGroupGetInfo
NetLocalGroupGetMembers
NetLocalGroupAddMembers
NetLocalGroupDelMembers
NetLocalGroupSetMembers
NetLocalGroupAdd
NetLocalGroupDel

## Local users

A maximum of 99 local users is permitted.

NetQueryDisplayInformation | This call works only for users, not for machines or groups.
NetUserGetInfo | Information level 0 only.
NetUserGetGroups | -

## Service Manager calls

The storage system supports the Service Manager just enough to tell Windows systems that no services are running.

CloseServiceHandle
OpenSCManager
OpenService

## Workstation calls

NetWkstaGetInfo | Levels 101, and 102 in Data ONTAP 6.2, level 100 only in prior releases.

## Registry Manipulation routines

RegOpenKeyEx
RegCloseKey
RegCreateKey
RegDeleteKey
RegDeleteValue
RegEnumKey
RegEnumValue
RegFlushKey
RegGetKeySecurity
RegLoadKey
RegOpenKey
RegQueryInfoKey
RegQueryValue
RegReplaceKey
RegRestoreKey
RegSaveKey
RegSetKeySecurity
RegSetValue
RegUnLoadKey
RegGetVersion

| Despite best efforts, this list is almost certainly incomplete. There is no one-to-one relationship between Win32 APIs and the actual remote procedure call and SMB calls that the storage system sees on the wire. If you are in doubt about whether a Win32 API that is not present on this list is supported on the storage system, you should add the call to a working Win32 application and see whether the call succeeds. Support for additional Microsoft APIs is added regularly by Data ONTAP developers as new needs arise. NetApp is a partner of Microsoft and a licensee of its interfaces. Send your feedback and comments to sdk-feedback@netapp.com.