Example #1
0
		void read(PCWSTR path, astring &buf)
		{
			memory::auto_close<HANDLE> file(::CreateFileW(path, GENERIC_READ, 0, nullptr, OPEN_EXISTING,
			FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS,
			                                            nullptr));
			if (file != INVALID_HANDLE_VALUE) {
				DWORD size = (DWORD)get_size(file);
				buf.reserve(size);
				CheckApi(::ReadFile(file, (PWSTR )buf.c_str(), buf.size(), &size, nullptr));
			}
		}