|
Home > Archive > Unix Programming > January 2006 > Port Win app to Linux Questions: Memory management and OEM Char
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Port Win app to Linux Questions: Memory management and OEM Char
|
|
| vansky 2006-01-13, 10:41 pm |
| Dear all,
im porting a WIN APP to LINUX, and face some problems that r hard for
me to solve, could u dear guys give me some hands?
i'd like to reimplement the following funcs or replace them with other
ways , but i have no idea how to !!
1. HLOCAL LocalAlloc( UINT uFlags, SIZE_T uBytes)
MSDN: The LocalAlloc function allocates the specified number of bytes
from the heap. Windows memory management does not provide a separate
local heap and global heap.
Also: LocalFree
2. HGLOBAL GlobalAlloc( UINT uFlags, SIZE_T dwBytes)
MSDN: The GlobalAlloc function allocates the specified number of bytes
from the heap. Windows memory management does not provide a separate
local heap and global heap.
Also: GlobalFree, GlobalLock, GlobalUnlock
3. LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize,DWORD
flAllocationType, DWORD flProtect )
MSDN: The VirtualAlloc function reserves or commits a region of pages
in the virtual address space of the calling process. Memory allocated
by this function is automatically initialized to zero, unless MEM_RESET
is specified.
Also: VirtualFree, VirtualLock, VirtualUnlock
4. BOOL AnsiToOem( LPCSTR lpszSrc,LPSTR lpszDst)
MSDN: Converts all the characters in this CStringT object from the ANSI
character set to the OEM character set.
Also: OemToAnsi, AnsiToOemBuff
thx!
| |
| Måns Rullgård 2006-01-13, 10:41 pm |
| "vansky" <huangms_van@hotmail.com> writes:
> Dear all,
>
> im porting a WIN APP to LINUX, and face some problems that r hard for
> me to solve, could u dear guys give me some hands?
>
> i'd like to reimplement the following funcs or replace them with other
> ways , but i have no idea how to !!
>
> 1. HLOCAL LocalAlloc( UINT uFlags, SIZE_T uBytes)
>
> MSDN: The LocalAlloc function allocates the specified number of bytes
> from the heap. Windows memory management does not provide a separate
> local heap and global heap.
malloc()
> Also: LocalFree
free()
> 2. HGLOBAL GlobalAlloc( UINT uFlags, SIZE_T dwBytes)
>
> MSDN: The GlobalAlloc function allocates the specified number of bytes
> from the heap. Windows memory management does not provide a separate
> local heap and global heap.
malloc()
> Also: GlobalFree,
free()
> GlobalLock, GlobalUnlock
noop
> 3. LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize,DWORD
> flAllocationType, DWORD flProtect )
>
> MSDN: The VirtualAlloc function reserves or commits a region of pages
> in the virtual address space of the calling process. Memory allocated
> by this function is automatically initialized to zero, unless MEM_RESET
> is specified.
mmap() with MAP_ANONYMOUS
> Also: VirtualFree,
munmap()
> VirtualLock, VirtualUnlock
noop
> 4. BOOL AnsiToOem( LPCSTR lpszSrc,LPSTR lpszDst)
>
> MSDN: Converts all the characters in this CStringT object from the ANSI
> character set to the OEM character set.
>
> Also: OemToAnsi, AnsiToOemBuff
iconv()
--
Måns Rullgård
mru@inprovide.com
| |
| vansky 2006-01-13, 10:41 pm |
| hi Rullg=E5rd,
4=2E OemToAnsi
i think u r right, using iconv_open(), iconv(), and iconv_close()
and i used "iconv --list" to get CHAR SET, i DON'T KNOW which 2 char
sets i should choose.
could anyone tell me whats the corresponding char set name of OEM and
ANSI ??
thx!
| |
| Roger Leigh 2006-01-13, 10:41 pm |
| -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
"vansky" <huangms_van@hotmail.com> writes:
> could anyone tell me whats the corresponding char set name of OEM
> and ANSI ??
ANSI have standardised quite a large number of character sets, so
without any context, the question has no meaning. OEM is apparently a
MS-ism for IBM DOS codepages, not a particular charset, and ANSI is
WinCP1252 (!):
http://www.concordancesoftware.co.uk/manual/hs3260.htm
http://www.cs.tut.fi/~jkorpela/chars.html
Basically, the MS nomenclature is meaningless garbage.
Regards,
Roger
- --
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
Debian GNU/Linux http://www.debian.org/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8+ <http://mailcrypt.sourceforge.net/>
iD8DBQFDx4JAVcFcaSW/ uEgRAsl2AKC5E9bwUKNNzwYhoS6VgAuvZv+MNwCd
GuZS
YwpIb/eZ2P8Xt1y1OlexOkU=
=TKkP
-----END PGP SIGNATURE-----
|
|
|
|
|