source: trunk/src/shell32/os2_integration.cpp@ 8048

Last change on this file since 8048 was 8048, checked in by sandervl, 23 years ago

PH: Wine resync + OS2 integration

File size: 2.3 KB
Line 
1/* $Id: os2_integration.cpp,v 1.1 2002-03-08 11:00:59 sandervl Exp $ */
2
3/*
4 * Win32 SHELL32 for OS/2
5 *
6 * Copyright 2002 Patrick Haller (patrick.haller@innotek.de)
7 * Project Odin Software License can be found in LICENSE.TXT
8 *
9 */
10
11
12/*****************************************************************************
13 * Includes *
14 *****************************************************************************/
15
16#define INCL_DOS
17#define INCL_DOSERRORS
18#define INCL_BASE
19#define INCL_WIN
20#define INCL_WINWORKPLACE
21#include <os2.h>
22
23#include <os2wrap.h>
24#include <win32type.h>
25#include <misc.h>
26#include <string.h>
27
28#include "os2_integration.h"
29
30
31// These constants shall resemble ODIN SHELL error codes
32#ifndef S_OK
33#define S_OK 0
34#endif
35
36#ifndef SE_ERR_OOM
37#define SE_ERR_OOM 8 /* out of memory */
38#endif
39
40#ifndef SE_ERR_ASSOCINCOMPLETE
41#define SE_ERR_ASSOCINCOMPLETE 27
42#endif
43
44
45#ifdef SE_ERR_NOASSOC
46#define SE_ERR_NOASSOC 31
47#endif
48
49
50
51
52DWORD ShellExecuteOS2(HWND hwndWin32,
53 LPCSTR pszOperation,
54 LPCSTR pszFile,
55 LPCSTR pszParameters,
56 LPCSTR pszDirectory,
57 INT iShowCmd)
58{
59 APIRET rc; /* API return code */
60 char szFileFull[260];
61
62 // verify parameter block
63
64 // Supported operations
65 if ( (NULL == pszOperation) &&
66 (stricmp( pszOperation, "open") != 0) &&
67 (stricmp( pszOperation, "play") != 0) )
68 {
69 // abort execution with error
70 return SE_ERR_ASSOCINCOMPLETE;
71 }
72
73 // @@@PH
74 // work directory currently ignored
75 // parameters currently ignored
76
77 // FS: is saved by the wrapper macros
78
79 // get fully-qualified name
80 rc = DosQueryPathInfo(pszFile, /* query the file information */
81 FIL_QUERYFULLNAME,
82 &szFileFull,
83 sizeof(szFileFull));
84 if (rc != NO_ERROR) /* check for errors */
85 return SE_ERR_ASSOCINCOMPLETE;
86
87
88 // Finally try to open the WPS object
89 HOBJECT hObject = WinQueryObject( szFileFull );
90 if (NULLHANDLE == hObject)
91 return SE_ERR_OOM;
92
93 WinSetObjectData(hObject, "OPEN=DEFAULT");
94
95 return S_OK;
96}
Note: See TracBrowser for help on using the repository browser.