[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: NtCreateFile fails
From:       Marcus Meissner <meissner () suse ! de>
Date:       2013-07-29 14:38:51
Message-ID: 20130729143846.GA12913 () suse ! de
[Download RAW message or body]

On Mon, Jul 29, 2013 at 04:02:03PM +0200, 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?


Try printing out the expanded string. It will probably just print "C"

L"string" does not work to specify WCHAR*, as the Linux L"" strings are
differently sized than the Windows L"" strings.

Ciao, Marcus


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic