Windows API Reference: Data Access
This section provides comprehensive documentation for Windows APIs related to data access, including file system operations, database connectivity, registry manipulation, and more.
Core Data Access APIs
File APIs
Interfaces and functions for interacting with the Windows file system.
-
HANDLE CreateFile( _In_ LPCTSTR lpFileName, _In_ DWORD dwDesiredAccess, _In_ DWORD dwShareMode, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _In_ DWORD dwCreationDisposition, _In_ DWORD dwFlagsAndAttributes, _In_opt_ HANDLE hTemplateFile );Creates or opens a file or I/O device.
Parameters:
- lpFileName: The name of the file or device.
- dwDesiredAccess: The access to the file or device.
- dwShareMode: A vector of bits that specify whether the calling process can have exclusive access to the file.
- lpSecurityAttributes: A SECURITY_ATTRIBUTES structure.
- dwCreationDisposition: Determines the action to take if the file exists or does not exist.
- dwFlagsAndAttributes: The file attributes and optional flags.
- hTemplateFile: A handle to a template file with the GENERIC_READ access right.
Return Value:
If the function succeeds, the return value is an open handle to the specified file or device. If the function fails, the return value is INVALID_HANDLE_VALUE.
-
BOOL ReadFile( _In_ HANDLE hFile, _Out_ LPVOID lpBuffer, _In_ DWORD nNumberOfBytesToRead, _Out_opt_ LPDWORD lpNumberOfBytesRead, _Inout_opt_ LPOVERLAPPED lpOverlapped );Reads data from a file or I/O device.
Parameters:
- hFile: A handle to the file or I/O device (hFile) that contains the data to be read.
- lpBuffer: A pointer to the buffer that receives the data read from the file or device.
- nNumberOfBytesToRead: The maximum number of bytes to be read.
- lpNumberOfBytesRead: A pointer to a variable that receives the number of bytes read.
- lpOverlapped: A pointer to an OVERLAPPED structure or NULL.
Return Value:
If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.
-
BOOL WriteFile( _In_ HANDLE hFile, _In_ LPCVOID lpBuffer, _In_ DWORD nNumberOfBytesToWrite, _Out_opt_ LPDWORD lpNumberOfBytesWritten, _Inout_opt_ LPOVERLAPPED lpOverlapped );Writes data to a file or I/O device.
Parameters:
- hFile: A handle to the file or I/O device.
- lpBuffer: A pointer to the buffer that contains the data to be written to the file or device.
- nNumberOfBytesToWrite: The number of bytes to be written.
- lpNumberOfBytesWritten: A pointer to a variable that receives the number of bytes written.
- lpOverlapped: A pointer to an OVERLAPPED structure.
Return Value:
If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.
Registry APIs
Functions for accessing and manipulating the Windows Registry.
-
LONG RegOpenKeyEx( _In_ HKEY hKey, _In_ LPCTSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult );Opens a specified registry key.
-
LONG RegSetValueEx( _In_ HKEY hKey, _In_opt_ LPCTSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ const BYTE* lpData, _In_ DWORD cbData );Sets the data and type of a specified registry value.
Database APIs
Information on accessing data using technologies like ADO and ODBC.
For detailed information on ADO and ODBC APIs, please refer to their specific documentation sections.
Storage APIs
APIs for interacting with various storage mechanisms, including COM interfaces and Windows Management Instrumentation (WMI).