NtCreateFile fails

Nikolay Sivov bunglehead at gmail.com
Mon Jul 29 09:07:54 CDT 2013


On 7/29/2013 18:02, Mislav Blazevic wrote:
> First of all, pardon my ignorance, I am new to wine and winapi.
>
> I am trying to implement apphelp.dll and I ran into issues with 
> NtCreateFile: It always returns 0xc0000103, STATUS_NOT_A_DIRECTORY, 
> and I am not sure what that means. Here is code:
>
> /* This function is not in API, but written for internal use */
> HANDLE WINAPI SdbOpenFile( LPCWSTR path, PATH_TYPE type )
> {
> /* SNIP */
> if (type == DOS_PATH)
> if (!RtlDosPathNameToNtPathName_U(path, &str, NULL, NULL))
> return NULL;
> InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, NULL, NULL);
> status = NtCreateFile(&file, GENERIC_READ | SYNCHRONIZE | 
> FILE_READ_ATTRIBUTES,
>  &attr, &io, NULL, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ,
>  FILE_OPEN, FILE_DIRECTORY_FILE, NULL, 0);
> /* SNIP */
> return file;
> }
>
> Function is called like this:
>
> WCHAR szFileName[1024] = {0};
> ExpandEnvironmentStringsW(L"%SystemRoot%\\sample.sdb", szFileName, 
> 1024); // for testing purposes
> SdbOpenFile(szFileName, DOS_PATH);
>
> Compiled with winegcc.
> I am sure that C:\windows\sample.sdb exists. What am I doing wrong?
Probably you don't nee****d FILE_DIRECTORY_FILE if it's not a directory?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20130729/516bc43b/attachment-0001.html>


More information about the wine-devel mailing list