DosQueryAppType

Returns the application type of an executable file.

Syntax
DosQueryAppType(pszName, pFlags)

Parameters

 * pszName (PSZ) - input : An ASCIIZ string that contains the file name of the executable file for which the flags are to be returned.
 * If the string appears to be a fully qualified path (that is, it contains a ":" in the second position, or it contains a "\", or both), then the file is located in the indicated drive:directory. If neither of these is true, and this file name is not found in the current directory, each drive:directory specification in the path defined in the current program's environment is searched for this file. Note that any extension (.xxx) is acceptable for the executable file name. If no extension is specified, a default extension of ".exe" is used.


 * pFlags (PULONG) - output : A doubleword that will contain flags denoting the application type, as determined by reading the executable file header specified by pszName. Note that the call sequence passes a pointer to a location in application memory to return the application type flags.
 * pFlags is defined as follows:

Return Code
ulrc (APIRET) - returns DosQueryAppType returns one of the following values:
 * 0 NO_ERROR
 * 2 ERROR_FILE_NOT_FOUND
 * 3 ERROR_PATH_NOT_FOUND
 * 4 ERROR_TOO_MANY_OPEN_FILES
 * 11 ERROR_BAD_FORMAT
 * 15 ERROR_INVALID_DRIVE
 * 32 ERROR_SHARING_VIOLATION
 * 108 ERROR_DRIVE_LOCKED
 * 110 ERROR_OPEN_FAILED
 * 191 ERROR_INVALID_EXE_SIGNATURE
 * 192 ERROR_EXE_MARKED_INVALID

Remarks
DosQueryAppType returns the application type of an executable file.

The Presentation Manager shell uses this function to determine the application type that is being executed.

The application type is specified at link time in the module definition file.

Example Code
This example shows how to obtain the application type of an executable file. 
 * 1) define INCL_DOSSESMGR  /* Session Manager values */
 * 2) define INCL_DOSERRORS  /* DOS error values       */
 * 3) include 
 * 4) include 

int main (VOID) { PSZ     szAppName = "C:\\OS2\\SYSLOG.EXE";  /* Application name      */ ULONG   AppType = 0;            /* Application type flags (returned) */ APIRET  rc      = NO_ERROR;     /* Return code                       */

rc = DosQueryAppType(szAppName, &AppType); /* On successful return, the AppType     */ /*  variable contains a set of bit flags */ /*  that describe the application type   */ /*  of the specified executable file     */

if (rc != NO_ERROR) { printf("DosQueryAppType error: return code = %u\n", rc); return 1; } else { printf("Appname = %s\n", szAppName); printf("Apptype = %d\n", AppType & FAPPTYP_EXETYPE); printf(" Window API?    %s\n", (AppType & FAPPTYP_WINDOWAPI) ? "Y" : "N"); printf(" Window compat? %s\n", (AppType & FAPPTYP_WINDOWCOMPAT) ? "Y" : "N"); printf(" Family API?    %s\n", (AppType & FAPPTYP_BOUND) ? "Y" : "N"); printf(" PC/DOS format? %s\n", (AppType & FAPPTYP_DOS) ? "Y" : "N"); printf(" DLL?           %s\n",                      (AppType & (FAPPTYP_DLL | FAPPTYP_PROTDLL) ) ? "Y" : "N"); }  return NO_ERROR; } 

Related Functions

 * DosLoadModule
 * DosQueryProcType