none
How compare two LPCSTR variable? RRS feed

  • Question

  • In Winapi, exists lstrcmp() and lstrcmpi() to compare 2 variable of type LPCSTR.

    Whats is equivalent function in WDK to do same work?


    • Edited by FLASHCODER Monday, April 10, 2017 2:24 AM
    Monday, April 10, 2017 2:22 AM

Answers

  • Well first the kernel expect you to know whether you are using wide or ansi characters.  Second, the standard string model in the kernel is a counted string, i.e. either UNICODE_STRING or ANSI_STRING.   Mostly the kernel expects UNICODE so the simple answer to your question is:

    LONG 
      RtlCompareUnicodeString(
        IN PUNICODE_STRING  String1,
        IN PUNICODE_STRING  String2,
        IN BOOLEAN  CaseInSensitive
        );
    
    
    

    There are ways to use NULL terminated string operations in the kernel, but they are not really recommended.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Monday, April 10, 2017 1:29 PM