🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #2057

HELP with GlobalDosAlloc

#2057
From: OLIVE JR,GEORGE A
Date: Fri, 12 Apr 1991 17:38
42 lines
2010 bytes
We are trying to use GlobalDosAlloc to allocate a block of memory to be
shared by a Windows application and a DOS application which has been
started using WinExec.  The following code shows the basic calls that
we are using.  wDosSeg is the real mode segment which is being sent as
a parameter to the DOS program.  hDos is a global memory handle which
is created from the selector in the LOWORD of the value returned by
GlobalDosAlloc and is used to access the memory from within Windows.
Unfortunately, this doesn't seem to work.  Data written to the memory
area pointed to by lpDos doesn't appear in the memory area wDosSeg:0000
when read by the DOS application.  We would be extremely grateful to 
anyone who can point out what we are doing wrong.


/***************************************************/
DWORD dwGlobalDos;
WORD wDosSeg;
HANDLE hDos;
LPSTR lpDos;

dwGlobalDos = GlobalDosAlloc(DOS_ALLOC_SIZE);
wDosSeg = HIWORD(dwGlobalDos);
hDos = LOWORD(GlobalHandle(LOWORD(dwGlobalDos)));
lpDos = (LPSTR) GlobalLock(hDos);
/***************************************************/



The DOS application is creating a pointer using wDosSeg with the following
code:

/***************************************************/
FP_SEG(ptr) = wDosSeg;  /* wDosSeg is passed as a parameter */
FP_OFF(ptr) = 0;
/***************************************************/


-- 
OLIVE JR,GEORGE A
Georgia Institute of Technology, Atlanta Georgia, 30332
uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!go3
Internet: go3@prism.gatech.edu
Technical Details
Message-ID: <26158@hydra.gatech.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!emory!gatech!prism!go3

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!emory!gatech!prism!go3
From: go3@prism.gatech.EDU (OLIVE JR,GEORGE A)
Newsgroups: comp.windows.ms.programmer
Subject: HELP with GlobalDosAlloc
Keywords: Windows Arggg help GlobalDosAlloc
Message-ID: <26158@hydra.gatech.EDU>
Date: 12 Apr 91 17:38:12 GMT
Distribution: na
Organization: Georgia Institute of Technology
Lines: 42