NtCreateFile fails

Mislav Blazevic krofnica996 at gmail.com
Mon Jul 29 09:02:03 CDT 2013


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20130729/49ef0d18/attachment.html>


More information about the wine-devel mailing list