11 constant(char *name, int arg)
14 if (name[0] == 'P' && name[1] == '_') {
15 if (strEQ(name, "P_BACKGROUND"))
21 if (strEQ(name, "P_DEBUG"))
27 if (strEQ(name, "P_DEFAULT"))
33 if (strEQ(name, "P_DETACH"))
39 if (strEQ(name, "P_FOREGROUND"))
45 if (strEQ(name, "P_FULLSCREEN"))
51 if (strEQ(name, "P_MAXIMIZE"))
57 if (strEQ(name, "P_MINIMIZE"))
63 if (strEQ(name, "P_NOCLOSE"))
69 if (strEQ(name, "P_NOSESSION"))
75 if (strEQ(name, "P_NOWAIT"))
81 if (strEQ(name, "P_OVERLAY"))
87 if (strEQ(name, "P_PM"))
93 if (strEQ(name, "P_QUOTE"))
99 if (strEQ(name, "P_SESSION"))
105 if (strEQ(name, "P_TILDE"))
111 if (strEQ(name, "P_UNRELATED"))
117 if (strEQ(name, "P_WAIT"))
123 if (strEQ(name, "P_WINDOWED"))
129 } else if (name[0] == 'T' && name[1] == '_') {
130 if (strEQ(name, "FAPPTYP_NOTSPEC"))
131 #ifdef FAPPTYP_NOTSPEC
132 return FAPPTYP_NOTSPEC;
136 if (strEQ(name, "T_NOTWINDOWCOMPAT"))
137 #ifdef FAPPTYP_NOTWINDOWCOMPAT
138 return FAPPTYP_NOTWINDOWCOMPAT;
142 if (strEQ(name, "T_WINDOWCOMPAT"))
143 #ifdef FAPPTYP_WINDOWCOMPAT
144 return FAPPTYP_WINDOWCOMPAT;
148 if (strEQ(name, "T_WINDOWAPI"))
149 #ifdef FAPPTYP_WINDOWAPI
150 return FAPPTYP_WINDOWAPI;
154 if (strEQ(name, "T_BOUND"))
156 return FAPPTYP_BOUND;
160 if (strEQ(name, "T_DLL"))
166 if (strEQ(name, "T_DOS"))
172 if (strEQ(name, "T_PHYSDRV"))
173 #ifdef FAPPTYP_PHYSDRV
174 return FAPPTYP_PHYSDRV;
178 if (strEQ(name, "T_VIRTDRV"))
179 #ifdef FAPPTYP_VIRTDRV
180 return FAPPTYP_VIRTDRV;
184 if (strEQ(name, "T_PROTDLL"))
185 #ifdef FAPPTYP_PROTDLL
186 return FAPPTYP_PROTDLL;
190 if (strEQ(name, "T_32BIT"))
192 return FAPPTYP_32BIT;
206 const char* const ptypes[] = { "FS", "DOS", "VIO", "PM", "DETACH" };
215 if (!(_emx_env & 0x200)) return (char*)ptypes[1]; /* not OS/2. */
216 if (CheckOSError(DosGetInfoBlocks(&tib, &pib)))
219 return (pib->pib_ultype <= 4 ? (char*)ptypes[pib->pib_ultype] : "UNKNOWN");
223 file_type(char *path)
228 if (!(_emx_env & 0x200))
229 croak("file_type not implemented on DOS"); /* not OS/2. */
230 if (CheckOSError(DosQueryAppType(path, &apptype))) {
231 if (rc == ERROR_INVALID_EXE_SIGNATURE)
232 croak("Invalid EXE signature");
233 else if (rc == ERROR_EXE_MARKED_INVALID) {
234 croak("EXE marked invalid");
236 croak("DosQueryAppType err %ld", rc);
243 fill_swcntrl(SWCNTRL *swcntrlp)
251 if (!(_emx_env & 0x200))
252 croak("switch_entry not implemented on DOS"); /* not OS/2. */
253 if (CheckOSError(DosGetInfoBlocks(&ptib, &ppib)))
254 croak("DosGetInfoBlocks err %ld", rc);
255 if (CheckWinError(hSwitch =
256 WinQuerySwitchHandle(NULLHANDLE,
257 (PID)ppib->pib_ulpid)))
258 croak("WinQuerySwitchHandle err %ld", Perl_rc);
259 if (CheckOSError(WinQuerySwitchEntry(hSwitch, swcntrlp)))
260 croak("WinQuerySwitchEntry err %ld", rc);
263 /* static ULONG (* APIENTRY16 pDosSmSetTitle)(ULONG, PSZ); */
264 ULONG _THUNK_FUNCTION(DosSmSetTitle)(ULONG, PSZ);
266 #if 0 /* Does not work. */
267 static ULONG (*pDosSmSetTitle)(ULONG, PSZ);
273 static HMODULE hdosc = 0;
277 fill_swcntrl(&swcntrl);
278 if (!pDosSmSetTitle || !hdosc) {
279 if (CheckOSError(DosLoadModule(buf, sizeof buf, "sesmgr", &hdosc)))
280 croak("Cannot load SESMGR: no `%s'", buf);
281 if (CheckOSError(DosQueryProcAddr(hdosc, 0, "DOSSMSETTITLE",
282 (PFN*)&pDosSmSetTitle)))
283 croak("Cannot load SESMGR.DOSSMSETTITLE, err=%ld", rc);
285 /* (pDosSmSetTitle)(swcntrl.idSession,s); */
287 (_THUNK_PROLOG (2+4);
288 _THUNK_SHORT (swcntrl.idSession);
290 _THUNK_CALLI (*pDosSmSetTitle)));
291 if (CheckOSError(rc))
292 warn("*DOSSMSETTITLE: err=%ld, ses=%ld, addr=%x, *paddr=%x",
293 rc, swcntrl.idSession, &_THUNK_FUNCTION(DosSmSetTitle),
303 static HMODULE hdosc = 0;
307 fill_swcntrl(&swcntrl);
309 (_THUNK_PROLOG (2+4);
310 _THUNK_SHORT (swcntrl.idSession);
312 _THUNK_CALL (DosSmSetTitle)));
314 if (CheckOSError(rc))
315 warn("DOSSMSETTITLE: err=%ld, ses=%ld, addr=%x",
316 rc, swcntrl.idSession, _THUNK_FUNCTION(DosSmSetTitle));
318 return !CheckOSError(rc);
322 #if 0 /* Does not work. */
323 USHORT _THUNK_FUNCTION(Win16SetTitle) ();
333 _THUNK_CALL (Win16SetTitle)));
334 if (CheckWinError(rc))
335 warn("Win16SetTitle: err=%ld", rc);
339 MODULE = OS2::Process PACKAGE = OS2::Process
360 fill_swcntrl(&swcntrl);
362 PUSHs(sv_2mortal(newSVpv(swcntrl.szSwtitle, 0)));
363 PUSHs(sv_2mortal(newSVnv(swcntrl.hwnd)));
364 PUSHs(sv_2mortal(newSVnv(swcntrl.hwndIcon)));
365 PUSHs(sv_2mortal(newSViv(swcntrl.hprog)));
366 PUSHs(sv_2mortal(newSViv(swcntrl.idProcess)));
367 PUSHs(sv_2mortal(newSViv(swcntrl.idSession)));
368 PUSHs(sv_2mortal(newSViv(swcntrl.uchVisibility != SWL_INVISIBLE)));
369 PUSHs(sv_2mortal(newSViv(swcntrl.uchVisibility == SWL_GRAYED)));
370 PUSHs(sv_2mortal(newSViv(swcntrl.fbJump == SWL_JUMPABLE)));
371 PUSHs(sv_2mortal(newSViv(swcntrl.bProgType)));