ZWcreate Fiel Eroor 0xc000003b

hi
sprintf(szFile, “\\.\ws”, pwszSymbolicLink);

RtlInitUnicodeString(&uniName, szFile);
DbgPrint(“file name %s\n”, uniName.Buffer);
InitializeObjectAttributes(&objAttr, &uniName, OBJ_CASE_INSENSITIVE , NULL, NULL);
ntstatus1 = ZwCreateFile(&m_hAdapter, GENERIC_READ | GENERIC_WRITE, &objAttr, &ioStatusBlock, NULL, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OPEN, FILE_NON_DIRECTORY_FILE, NULL, 0);

giving Error 0xC000003B STATUS_OBJECT_PATH_SYNTAX_BAD
im trying to open a network adapter

xxxxx@gmail.com xxxxx@lists.osr.com wrote:

hi
sprintf(szFile, “\\.\ws”, pwszSymbolicLink);

RtlInitUnicodeString(&uniName, szFile);

szFile is not a Unicode string.

In fact, what you have there will create the ANSI string \.\ws, which
is certainly not what you wanted. Even if you had included the % sign
that you forgot, that function would convert the Unicode
pwszSymbolicLink to an ANSI string, and that ANSI string will look like
garbage to ZwCreateFile.

DECLARE_UNICODE_STRING_SIZE( uniName, pwszSymbolicLink->Size + 5 );
RtlAppendUnicodeToString( &uniName, L"\\.\" );
RtlAppendUnicodeToString( &uniName, pwszSymbolicLink );


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.