| 1 | /* $Id$ */ |
| 2 | /** @file |
| 3 | * |
| 4 | * SafeDosQueryAppType() |
| 5 | * |
| 6 | * Copyright (c) 2007 Peter Weilbacher <mozilla@weilbacher.org> |
| 7 | * Copyright (c) 2003 knut st. osmundsen <bird-srcspam@anduin.net> |
| 8 | * (code adapted from SafeDosQueryFHState.c and SafeDosOpenL.c) |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with This program; if not, write to the Free Software |
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 23 | * |
| 24 | */ |
| 25 | |
| 26 | #define INCL_BASE |
| 27 | #include <os2.h> |
| 28 | #include "safe.h" |
| 29 | |
| 30 | APIRET APIENTRY SafeDosQueryAppType(PSZ pszFile, PULONG pulFlags); |
| 31 | APIRET APIENTRY SafeDosQueryAppType(PSZ pszFile, PULONG pulFlags) |
| 32 | { |
| 33 | ULONG rc, ul; |
| 34 | PULONG pul = NULL; |
| 35 | // even though pszFile is PSZ and not PSCZ, use of the PCSZ macros |
| 36 | // should be safe |
| 37 | SAFE_PCSZ(pszFile); |
| 38 | |
| 39 | if (pulFlags) |
| 40 | { |
| 41 | ul = *pulFlags; |
| 42 | pul = &ul; |
| 43 | } |
| 44 | |
| 45 | rc = DosQueryAppType(SAFE_PCSZ_USE(pszFile), pul); |
| 46 | |
| 47 | if (pulFlags) |
| 48 | *pulFlags = ul; |
| 49 | |
| 50 | SAFE_PCSZ_DONE(pszFile); |
| 51 | SAFE_DOS_FAILURE(); |
| 52 | |
| 53 | return rc; |
| 54 | } |
| 55 | |