TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Richard Stack
from: Doug Nazar
date: 1995-11-16 03:11:20
subject: Problem with WinSetFilePtr

Hello Richard!

Tuesday November 14 1995 13:16, Richard Stack wrote to All:

RS> /* error checking removed */
RS> LONG lDistance = 0;
RS> PULONG pNewPtr;

Change to
    ULONG ulNewPtr;

RS> rc1 = DosOpen (pchFile, &hFileHandle, &ulAction, 0, FILE_NORMAL,
RS>                 OPEN_ACTION_OPEN_IF_EXISTS |
RS>                 OPEN_ACTION_CREATE_IF_NEW,
RS>                 OPEN_ACCESS_READWRITE |
RS>                 OPEN_SHARE_DENYREADWRITE |
RS>                 OPEN_FLAGS_RANDOM, NULL );
RS> rc2 = DosSetFilePtr (hFileHandle, lDistance, FILE_END, pNewPtr); // Move
RS> pointer to end

change to
 rc2 = DosSetFilePtr (hFileHandle, lDistance, FILE_END, &ulNewPtr);

RS> rc3 = DosWrite ( hFileHandle, (PVOID)&ClientData, sizeof
RS> (ClientData), &ulWritten);DosClose (hFileHandle);

That should solve the problem. You simply didn't have the memory allocated
wherever pNewPtr was pointed to which was causing the exception.

Doug

--- GoldED/2 2.50 UNREG
* Origin: Realm of the Dragons - `Where thy mind hath no limits' (1:250/516)
SEEN-BY: 270/101 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 517 628 713/888 800/1 7877/2809
@PATH: 250/516 101 99 3615/50 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.