convert PUNICODE_STRING to wchar*

Dear All,

I need to find a substring in a string. I have the string in PUNICODE_STRING
format and i am using wcssstr function for this :
///////////////

PUINCODE_STRING fileName ; // I am getting the file name in this
WCHAR whetherInBuffer[200];

if(fileName->Length < (2*200)) {
int i=0;
for(i=0; i < fileName->Length/2; i++) {
whetherInBuffer[i] = fileName->Buffer[i];
}
whetherInBuffer[i] = L’\0’;
_wcsupr(whetherInBuffer);

//////////////

Then i compare the given substring using wcssstr

if(wcssstr(whetherInBuffer,“\ROHIT”))
{

}

/////////////////

Is there any alternative way to compare the substring in a string in which
i donot require to convert PUNICODE to WCHAR array. ??

Regards,
Rohit

Write your own wcssstr or look in NtStrSafe.h - maybe there is such a
function there.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Rohit Dhamija”
Newsgroups: ntfsd
To: “Windows File Systems Devs Interest List”
Sent: Monday, April 05, 2004 3:57 PM
Subject: [ntfsd] convert PUNICODE_STRING to wchar*

> Dear All,
>
> I need to find a substring in a string. I have the string in PUNICODE_STRING
> format and i am using wcssstr function for this :
> ///////////////
>
> PUINCODE_STRING fileName ; // I am getting the file name in this
> WCHAR whetherInBuffer[200];
>
> if(fileName->Length < (2*200)) {
> int i=0;
> for(i=0; i < fileName->Length/2; i++) {
> whetherInBuffer[i] = fileName->Buffer[i];
> }
> whetherInBuffer[i] = L’\0’;
> _wcsupr(whetherInBuffer);
>
> //////////////
>
> Then i compare the given substring using wcssstr
>
> if(wcssstr(whetherInBuffer,“\ROHIT”))
> {
> …
> }
>
> /////////////////
>
> Is there any alternative way to compare the substring in a string in which
> i donot require to convert PUNICODE to WCHAR array. ??
>
> Regards,
> Rohit
>
>
>
> —
> Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com