atl: Compare file handle to INVALID_HANDLE_VALUE to handle errors.
This commit is contained in:
parent
26344ce3f2
commit
ecac3c1c06
|
@ -479,7 +479,7 @@ static HRESULT file_register(Registrar *This, LPCOLESTR fileName, BOOL do_regist
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
file = CreateFileW(fileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL);
|
file = CreateFileW(fileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL);
|
||||||
if(file) {
|
if(file != INVALID_HANDLE_VALUE) {
|
||||||
filelen = GetFileSize(file, NULL);
|
filelen = GetFileSize(file, NULL);
|
||||||
regstra = HeapAlloc(GetProcessHeap(), 0, filelen);
|
regstra = HeapAlloc(GetProcessHeap(), 0, filelen);
|
||||||
lres = ReadFile(file, regstra, filelen, NULL, NULL);
|
lres = ReadFile(file, regstra, filelen, NULL, NULL);
|
||||||
|
|
Loading…
Reference in New Issue