Port Win app to Linux Questions: Memory management and OEM Char
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Port Win app to Linux Questions: Memory management and OEM Char




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Port Win app to Linux Questions: Memory management and OEM Char  
vansky


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-14-06 03:41 AM

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!






[ Post a follow-up to this message ]



    Re: Port Win app to Linux Questions: Memory management and OEM Char  
Måns Rullgård


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-14-06 03:41 AM

"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





[ Post a follow-up to this message ]



    Re: Port Win app to Linux Questions: Memory management and OEM Char  
vansky


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-14-06 03:41 AM

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!






[ Post a follow-up to this message ]



    Re: Port Win app to Linux Questions: Memory management and OEM Char  
Roger Leigh


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-14-06 03:41 AM

-----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-----





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 05:34 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register