source: trunk/src/shlwapi/shlwapi.cpp@ 5472

Last change on this file since 5472 was 5472, checked in by sandervl, 24 years ago

compile fix

File size: 3.8 KB
Line 
1/* $Id: shlwapi.cpp,v 1.10 2001-04-04 09:05:50 sandervl Exp $ */
2
3/*
4 * Win32 URL-handling APIs for OS/2
5 *
6 * Copyright 1999 Patrick Haller <phaller@gmx.net>
7 *
8 * Project Odin Software License can be found in LICENSE.TXT
9 *
10 * Copyright 1996,1998 Marcus Meissner
11 * Copyright 1996 Jukka Iivonen
12 * Copyright 1997 Uwe Bonnes
13 * Copyright 1999 Jens Wiessner
14 *
15 * Two functions (WINE_StringFromCLSID and StringFromGUID2) are directly
16 * borrowed from ole32/clsid.cpp. This is to avoid the direct dependency
17 * between SHLWAPI.DLL and the OLE32.DLL.
18 */
19
20
21#include <odin.h>
22#include <odinwrap.h>
23#include <os2sel.h>
24
25#include <string.h>
26#include <ctype.h>
27#include <wctype.h>
28#define HAVE_WCTYPE_H
29#include <odin.h>
30
31#define ICOM_CINTERFACE 1
32#define CINTERFACE 1
33
34#include "debugtools.h"
35#include "winnls.h"
36#include "winversion.h"
37#include "winreg.h"
38#include "crtdll.h"
39
40#include <heapstring.h>
41#include <misc.h>
42#include <unicode.h>
43#include <win\shell.h>
44#include <win\winerror.h>
45
46// import OLE support
47#include <win/wtypes.h>
48#define OLE_OK 0
49
50
51ODINDEBUGCHANNEL(SHLWAPI)
52
53#include "shlwapi.h"
54
55
56/*
57 * This enables procedures to automatically take care or
58 * required unicode conversion or not.
59 */
60
61BOOL VERSION_OsIsUnicode(void)
62{
63 static version = 0;
64
65 if(version == 0) {
66 version = GetVersion();
67 }
68 /* if high-bit of version is 0, we are emulating NT */
69 return !(version & 0x80000000);
70}
71
72
73// ----------------------------------------------------------------------
74// WINE_StringFromCLSID
75// ----------------------------------------------------------------------
76HRESULT WINAPI WINE_StringFromCLSID(const CLSID *rclsid, LPSTR idstr)
77{
78// dprintf(("OLE32: WINE_StringFromCLSID"));
79
80 if (rclsid == NULL)
81 {
82 dprintf((" clsid: (NULL)"));
83 *idstr = 0;
84 return E_FAIL;
85 }
86
87 // Setup new string...
88 sprintf(idstr, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
89 rclsid->Data1,
90 rclsid->Data2,
91 rclsid->Data3,
92 rclsid->Data4[0],
93 rclsid->Data4[1],
94 rclsid->Data4[2],
95 rclsid->Data4[3],
96 rclsid->Data4[4],
97 rclsid->Data4[5],
98 rclsid->Data4[6],
99 rclsid->Data4[7]);
100
101// dprintf((" clsid: %s", idstr));
102
103 return OLE_OK;
104}
105
106// ----------------------------------------------------------------------
107// StringFromGUID2
108// ----------------------------------------------------------------------
109int WINAPI StringFromGUID2(REFGUID rguid, LPOLESTR lpsz, int cbMax)
110{
111// NB cbMax is a CHARACTER count not a BYTE count... :-)
112 char tmp[50];
113 size_t strLen;
114
115 // Setup new string...
116 WINE_StringFromCLSID(rguid, tmp);
117
118 strLen = (strlen(tmp) + 1);
119 if (strLen > cbMax)
120 strLen = cbMax;
121
122 AsciiToUnicodeN(tmp, lpsz, strLen);
123
124 return strLen; // Num CHARACTERS including 0 terminator
125}
126
127
128/*****************************************************************************
129 * Name : DllGetVersion
130 * Purpose : Return version information about the DLL used
131 * Parameters:
132 * Variables :
133 * Result :
134 * Remark : SHLWAPI.446
135 * Status : UNTESTED
136 *
137 * Author :
138 *****************************************************************************/
139
140typedef struct tagDLLVERSION
141{
142 DWORD dwLength; // == 0x14
143 DWORD dwMajorVersion;
144 DWORD dwMinorVersion;
145 DWORD dwRevision;
146 DWORD dwBuildNumber;
147} DLLVERSION, *LPDLLVERSION;
148
149
150ODINFUNCTION1(DWORD, DllGetVersion,
151 LPDLLVERSION, lpBuffer)
152{
153 if (lpBuffer == NULL)
154 return E_INVALIDARG; // error code: invalid parameters
155
156 if (IsBadWritePtr(lpBuffer,
157 20))
158 return E_INVALIDARG;
159
160 if (lpBuffer->dwLength != sizeof(DLLVERSION))
161 return E_INVALIDARG;
162
163 // our current version is 5.0.2314.1000
164 lpBuffer->dwMajorVersion = 5;
165//lpBuffer->dwMinorVersion = 0; // @@@PH not touched in windows code ?
166 lpBuffer->dwRevision = 2314;
167 lpBuffer->dwBuildNumber = 1;
168
169 return ERROR_SUCCESS;
170}
Note: See TracBrowser for help on using the repository browser.