哪位能否讲解一下 RtlInitEmptyUnicodeString和RtlInitUnicodeString的用法 它们有何区别?

解决方案 »

  1.   

    1 .RtlInitEmptyUnicodeString
    The RtlInitEmptyUnicodeString macro initializes an empty counted Unicode string. VOID
      RtlInitEmptyUnicodeString(
        IN OUT PUNICODE_STRING  DestinationString,
        IN PCWSTR  Buffer,
        IN USHORT  BufferSize
        ); 
    Parameters
    DestinationString 
    Pointer to the UNICODE_STRING structure to be initialized. 
    Buffer 
    Pointer to a caller-allocated buffer to be used to contain a WCHAR string. 
    BufferSize 
    Length, in bytes, of the buffer pointed to by Buffer. Return Value
    None Headers
    Declared in ntifs.h. Include ntifs.h. Comments
    This macro is available on Microsoft Windows XP and later. The members of DestinationString are initialized as follows: Member Value 
    Length Zero 
    MaximumLength BufferSize 
    Buffer SourceString 
    To initialize a nonempty counted Unicode string, call RtlInitUnicodeString. Callers of RtlInitEmptyUnicodeString can be running at any IRQL. 2. RtlInitUnicodeString Function--------------------------------------------------------------------------------Initializes a counted Unicode string. SyntaxVOID RtlInitUnicodeString(          PUNICODE_STRING DestinationString,
        PCWSTR SourceString
    );
    ParametersDestinationString
    [in, out] Pointer to the buffer for a counted Unicode string to be initialized. The length is initialized to zero if the SourceString is not specified. 
    SourceString
    [in] Optional pointer to a null-terminated Unicode string with which to initialize the counted string. 
    Return ValueNone.
    Function InformationHeader winternl.h 
    Import library None 
    Minimum operating systems Windows 2000 3. WCHAR wcString[64];
       UNICODE_STRING ucString0,ucString1;
       RtlInitEmptyUnicodeString(&ucString0,wcString,64);
       RtlInitUnicodeString(&ucString1,L"ABCD");