Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Sept/Oct 2019 Issue of The NT Insider available


Download PDF here: http://insider.osr.com/2019/ntinsider_2019_01.pdf

It’s a particularly BIG issue, too: 40 pages of technical goodness, ranging from WDF to Minifilters. Check it out.
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

Regex library

Mauro_LeggieriMauro_Leggieri Member Posts: 76

Hi,

Does anyone know a Windows-Kernel-Development-Friendly regular expression library?

I don't need advanced features like back references or class matching (they tend to use tables and will make the driver size big) but I can do things like adding unicode support.

Did some lookup but C++ libraries usually depends on std and C ones seems not fully tested.

Thanks,
Mauro.

Comments

  • Martin_DrábMartin_Dráb Member - All Emails Posts: 61

    What about T-Rex?
    https://github.com/kimperator/T-Rex

    It is written in quite portable manner (Linux/Windows) and AFAIK have no dependencies except C runtime library (which works quite well in kernelmode too). Of course, you need to port the library for the kernel land (and test it there) but it should not take you long to achieve that.

    Martin Dráb

  • Mauro_LeggieriMauro_Leggieri Member Posts: 76

    Hi @Martin_Dráb, I saw it but seems it has issues.

    Thanks.

  • Scott_Noone_(OSR)Scott_Noone_(OSR) Administrator Posts: 3,159

    Any chance of redesigning the code so that the regex can be done in user mode? I wouldn't trust trying to jam anything that complicated into kernel mode. If I can't do it with FsRtlIsNameInExpression then I usually try to find another way around...

    -scott
    OSR

  • Mauro_LeggieriMauro_Leggieri Member Posts: 76

    Hi @Scott_Noone_(OSR), how are you?

    Honestly I prefer to avoid it. Currently I have a simple wildcard matcher to match * and ? but I would like to match ** like Linux to match if a file is inside a folder or a subfolder but seems it is not straightforward to implement.

    Kind regards,
    Mauro.

  • Scott_Noone_(OSR)Scott_Noone_(OSR) Administrator Posts: 3,159

    Very well, thanks for asking! Back to school season around here so things are always a bit crazy...

    I don't have a generic solution to your problem (and I'm Linux illiterate), but if you're looking for prefix matching there's RtlPrefixUnicodeString.

    And, in case it's interesting, I was also recently made aware of a prefix matching package available in kernel mode. See RtlInitializeUnicodePrefix as a jumping off point for more info (have not ever used it so I have no practical experience to share).

    -scott
    OSR

  • Mauro_LeggieriMauro_Leggieri Member Posts: 76

    Very well, thanks for asking! Back to school season around here so things are always a bit crazy...

    Good to hear.

    I don't have a generic solution to your problem (and I'm Linux illiterate), but if you're looking for prefix matching there's RtlPrefixUnicodeString.

    I'll try to create some code. That double star addition was a simple and great idea.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
Writing WDF Drivers 21 Oct 2019 OSR Seminar Space & ONLINE
Internals & Software Drivers 18 Nov 2019 Dulles, VA
Kernel Debugging 30 Mar 2020 OSR Seminar Space
Developing Minifilters 27 Apr 2020 OSR Seminar Space & ONLINE