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


  • 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:

        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:

    Monday, April 10, 2017 1:29 PM