João Diogo Ferreira devilj@outlook.pt writes:
- if (!(hkey = create_registry_key())) return FALSE;
- if (!geoinfo)
- {
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
- }
- if (!(hkey = create_registry_key()))
- {
SetLastError(ERROR_INTERNAL_ERROR);
return FALSE;
- }
It's not useful to set last error, especially not to a meaningless value like ERROR_INTERNAL_ERROR, unless there are test cases demonstrating that Windows does the same thing.
- if (NtCreateKey(&hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL) != STATUS_SUCCESS) { NtClose(attr.RootDirectory);
SetLastError(ERROR_INTERNAL_ERROR);
Same here.