LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 07-25-2004, 12:17 PM   #1
Joe056
LQ Newbie
 
Registered: Jul 2004
Posts: 2

Rep: Reputation: 0
windows.h datatypes to linux conversion


Hello-

I am working on a project to convert several windows programs into linux, but I am having a hard time finding the definitions of many windows datatypes (go figure ;-)... I was hoping that someone knew what kind of datatypes DWORD, WORD, OVERLAPPED, HANDLE, and NEAR are. Also- do you have any suggestions about how to convert them? Is there a way to install windows.h onto linux?

Thanks a bunch.
Joe
 
Old 07-25-2004, 01:07 PM   #2
fr0zen
Member
 
Registered: Nov 2003
Location: 127.0.0.1
Distribution: xubuntu
Posts: 217

Rep: Reputation: 30
As far as I know, these are correct:

DWORD = long (a 32 bit value)
WORD = int (16 bit value)
HANDLE = void *

I do not know what OVERLAPPED is. However, I've encountered NEAR keyword (I should say declaration, since Microsoft absolutely finds it necessary to declare macros for everything), and NEAR's complement, FAR. These are actually 'near' and 'far' in the C language, and aren't used often anymore (except maybe some low level stuff).

From what I remember, these keywords were used some time ago on 16 bit Intel machines. Using the 'near' keyword, would force the storage pointer to require 16 bits, whereas far would require 32 bits. far, though, would be composed of 2 near pointers, one padded with 4 bits. Effectively this would give you only 28 bits of space...

OVERLAPPED, however, never seen that. Sorry.

Hope that helps.

By the way, if you want more definitions, I suggest you check out windefs.h.

Last edited by fr0zen; 07-25-2004 at 01:09 PM.
 
Old 07-25-2004, 01:33 PM   #3
fr0zen
Member
 
Registered: Nov 2003
Location: 127.0.0.1
Distribution: xubuntu
Posts: 217

Rep: Reputation: 30
I should have mentioned this before, but, if you are looking to convert programs from Windows C code, check out Winelib at http://www.winehq.com/site/docs/winelib-user/index.

It's not perfect yet, but, it may do what you want.
 
Old 07-25-2004, 01:45 PM   #4
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 42
Quote:
DWORD = long (a 32 bit value)
WORD = int (16 bit value)
This is a little misleading because int and long aren't guaranteed to be 16 and 32 bits. In particular, they are both 32 bits on x86 (maybe only a more modern subcategory of x86?), If you want a 32 bit value, you should use int32_t (and likewise int16_t) in <stdint.h>.
 
Old 07-25-2004, 04:25 PM   #5
fr0zen
Member
 
Registered: Nov 2003
Location: 127.0.0.1
Distribution: xubuntu
Posts: 217

Rep: Reputation: 30
Very true, and I should have made a note about that in my post.
 
Old 07-28-2004, 03:31 PM   #6
Joe056
LQ Newbie
 
Registered: Jul 2004
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks!

Thanks guys, that will help a lot. I will try to mess around with some of the wine and winelib stuff to see how that goes.

Joe
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Another conversion to Linux.. kevinatkins General 8 10-23-2005 01:26 AM
iPod conversion on Linux ilikejam Linux - Hardware 2 03-26-2005 07:38 AM
Windows to Linux Conversion tamakizu Linux - General 1 07-13-2004 03:41 PM
Linux Conversion NEED HELP! Madmanator Linux - Newbie 5 01-04-2002 05:35 PM
linux conversion emory7825 Linux - General 3 11-06-2001 03:55 AM


All times are GMT -5. The time now is 06:12 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration