Re: length checking...



I didnt understand 'type'? It is not null terminated - I get it from a user
mode app thru a oid call. ANSI string.

Change your OID interface to always:

a) use Unicode strings only, the legacy apps can do their own ANSI conversion
if they need so
b) always provide the length together with the string, never relying on zero
termination. Nearly no code in Windows kernel relies on zero termination of the
string, the strings are always counted UNICODE_STRING there.

Note: Win9x is dead, so all apps are becoming NT-only, which means - no reasons
at all in ever building any code with ANSI build options.

We are Unicode-only and UTF-8 (for IETF protocols like HTTP) now.

Unicode is much simpler then ANSI, and I would recommend Unicode for beginners
:) just consider the Japanese market, for Japanese, Unicode is same simple, and
ANSI turns to a misdesigned nightmare of DBCS.

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

.



Relevant Pages

  • Re: Error 52 Bad file name or number on file read
    ... Sorry Nick but if you're ending up with a mixture of ANSI and Unicode data ... Private Type FILETIME ... Public Function StripNulls(sText As String) As String ...
    (microsoft.public.vb.general.discussion)
  • Re: Did Borland doing well in Q4? Listen to the Earning CC
    ... AS an ANSI application you will need to change all "String" ... declarations to "ANSIString" (and Char to ANSIChar and PChar to ... Only THEN can you start thinking about how Unicode is best ... Even the specifically "ANSI" FS routines do not use ...
    (borland.public.delphi.non-technical)
  • Re: using structs like BROWSEINFO and OPENFILENAME (string members
    ... your discussion of unicode ... vs ansi reminded me to recheck my typelib and found a couple of errors. ... > is declared as string, the other is declared as long. ...
    (microsoft.public.vb.winapi)
  • Re: api call for tchar*
    ... > String passes an ANSI version while a ByRef passes a Unicode version. ... The row of characters is preceded by a Long ...
    (microsoft.public.vb.winapi)
  • Re: Problem to write data on a file
    ... Windows CE/Pocket PC/Windows Mobile is heavily biased towards UNICODE. ... This line stores an ASCII string in c. ... most apps will have no problem. ...
    (microsoft.public.pocketpc.developer)

Quantcast