Calling CreateFile() does not itself buffer or otherwise read the contents of the target file. After calling CreateFile(), you must call ReadFile() to obtain whatever parts of the file you want, for example to read the first kilobyte of a file:
DWORD cbRead;
BYTE buffer[1024];
HANDLE hFile = ::CreateFile(filename,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
::ReadFile(hFile, sizeof(buffer), &cbRead, NULL);
::CloseHandle(hFile);
In addition, if you want to read a random portion of the file, you can use SetFilePointer() before calling ReadFile(), for example to read one kilobyte starting one megabyte into the file:
DWORD cbRead;
BYTE buffer[1024];
HANDLE hFile = ::CreateFile(filename,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
::SetFilePointer(hFile, 1024 * 1024, NULL, FILE_BEGIN);
::ReadFile(hFile, sizeof(buffer), &cbRead, NULL);
::CloseHandle(hFile);
You may, of course, call SetFilePointer() and ReadFile() as many times as you wish while the file is open. A call to ReadFile() implicitly sets the file pointer to the byte immediately following the last byte read by ReadFile().
Additionally, you should read the documentation for the File Management Functions you use, and check the return values appropriately to trap any errors that might occur.
Windows may, at its discretion, use available system memory to cache the contents of open files, but data cached by this process will be discarded if the memory is needed by a running program (after all, the cached data can just be re-read from the disk if it is needed).