Re: SysFreeString - Is the memory mine to use as I please ?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi mate

1) Am I allowed to do the Wide-char to ASCII conversion in-place ?

You can , but this is not as simple as just a type cast - there are
system-provided functions for this purpose, and they do the conversion
for a particular type of wide string. For example, BSTR,
null-terminated string of wide characters and UNICODE_STRING are all
different types of wide-character string, so that they require
different conversion functions

2) How is SysFreeMemory different from Local/GlobalFree.

Local/GlobalFree are provided only for compatibility with 16-bit
Windows - there is no such thing as local/global memory under NT-based
system. SysFreeString()
simply deallocates memory for the string that has been dynamically
allocated by SysAllocString(). Therefore, your can think of them in
terms of malloc() - free() pair

Anton Bassov




R.Wieser wrote:
Hello All,

I'm working at some code communicating with an ActiveX-component, and get
Wide-char results in a string that I have to discard using "SysFreeMemory".

As I want to convert that wide-char string to a simple ASCII first I have
two questions :

1) Am I allowed to do the Wide-char to ASCII conversion in-place ? In
other words : is the memory that Wide-char is placed in mine to do with as I
please ?

2) How is SysFreeMemory different from Local/GlobalFree. I suspect it has
got something to do with who actually "owns" the memory, but I'm not at all
sure.

Regards,
Rudy Wieser

.



Relevant Pages