home *** CD-ROM | disk | FTP | other *** search
- /*
- FPRTNAME.C -- Demonstrates GetFilePortName
-
- From Chapter 6 of "Undocumented Windows" (Addison-Wesley 1992)
- by Andrew Schulman, Dave Maxey and Matt Pietrek
-
- Build using: WINIOBC FPRTNAME (for Borland C++ v3.00)
- WINIOMS FPRTNAME (for Microsoft C/SDK)
- */
-
- #include <windows.h>
- #include <string.h>
- #include "winio.h"
-
- /* undocumented function */
- extern WORD FAR PASCAL GetFilePortName(LPOFSTRUCT lpofstruct);
-
- #include "checkord.c"
-
- int main()
- {
- WORD wRet;
- OFSTRUCT ofstruct;
-
- if (! CheckOrdName("GetFilePortName", "USER", 343))
- return 0;
-
- winio_about("FPRTNAME"
- "\nDemonstrates GetFilePortName"
- "\n\nFrom Chapter 6 of"
- "\n\"Undocumented Windows\" (Addison-Wesley, 1992)"
- "\nby Andrew Schulman, David Maxey and Matt Pietrek"
- );
-
- winio_setecho(winio_current(), FALSE);
-
- for (;;)
- {
- wRet = GetFilePortName((LPOFSTRUCT) &ofstruct);
-
- printf("GetFilePortName returned %d\n", wRet);
- if (wRet == 1)
- printf(
- "In the OFSTRUCT:\n"
- "structure length: %d\n"
- "fixed disk file : %s\n"
- "dos error code : %d\n"
- "full file name : %s\n",
- ofstruct.cBytes,
- ofstruct.fFixedDisk ? "Yes" : "No",
- ofstruct.nErrCode,
- ofstruct.szPathName);
-
- printf("\nPress a key to do it again\n"
- "or close the window to exit\n\n");
-
- getchar();
- }
-
- return 0;
- }
-