30FILE_RCSID(
"@(#)$File: apptype.c,v 1.17 2022/12/26 17:31:14 christos Exp $")
40#define INCL_DOSFILEMGR
45file_os2_apptype(
struct magic_set *ms,
const char *fn,
const void *
buf,
49 char path[_MAX_PATH], drive[_MAX_DRIVE],
dir[_MAX_DIR],
50 fname[_MAX_FNAME],
ext[_MAX_EXT];
55 filename = strdup(fn);
56 else if ((filename =
tempnam(
"./",
"tmp")) ==
NULL) {
61 _splitpath(filename, drive,
dir, fname,
ext);
63 (*
dir ==
'\0') ?
"./" :
dir,
65 (*
ext ==
'\0') ?
"." :
ext);
80 rc = DosQueryAppType((
unsigned char *)path, &
type);
87 if (rc == ERROR_INVALID_EXE_SIGNATURE)
88 printf(
"%s: not an executable file\n", fname);
89 else if (rc == ERROR_FILE_NOT_FOUND)
90 printf(
"%s: not found\n", fname);
91 else if (rc == ERROR_ACCESS_DENIED)
92 printf(
"%s: access denied\n", fname);
94 printf(
"%s: error code = %lu\n", fname, rc);
108 if (
type & FAPPTYP_32BIT)
111 if (
type & FAPPTYP_PHYSDRV) {
112 if (
file_printf(ms,
"physical device driver") == -1)
114 }
else if (
type & FAPPTYP_VIRTDRV) {
115 if (
file_printf(ms,
"virtual device driver") == -1)
117 }
else if (
type & FAPPTYP_DLL) {
118 if (
type & FAPPTYP_PROTDLL)
123 }
else if (
type & (FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT)) {
126 }
else if (
type & FAPPTYP_DOS) {
142 }
else if (
type & FAPPTYP_BOUND) {
145 }
else if ((
type & 7) == FAPPTYP_WINDOWAPI) {
148 }
else if (
file_printf(ms,
"OS/2 executable") == -1)
151 switch (
type & (FAPPTYP_NOTWINDOWCOMPAT |
152 FAPPTYP_WINDOWCOMPAT |
153 FAPPTYP_WINDOWAPI)) {
154 case FAPPTYP_NOTWINDOWCOMPAT:
158 case FAPPTYP_WINDOWCOMPAT:
162 case FAPPTYP_WINDOWAPI:
file_private const char ext[]
unlink(string $filename, $context=null)
printf(string $format, mixed ... $values)
tempnam(string $directory, string $prefix)
fwrite($stream, string $data, ?int $length=null)
dir(string $directory, $context=null)
fopen(string $filename, string $mode, bool $use_include_path=false, $context=null)
zend_ffi_ctype_name_buf buf
file_protected int file_printf(struct magic_set *, const char *,...) __attribute__((__format__(__printf__
file_protected void file_error(struct magic_set *, int, const char *,...) __attribute__((__format__(__printf__
sprintf("0x%X", $numelems)
strncmp(string $string1, string $string2, int $length)
ZEND_API void(ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data)