| 1 | /* $Id: shlwapi.cpp,v 1.8 2000-06-12 08:09:40 phaller 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 <win\shell.h>
|
|---|
| 43 | #include <win\winerror.h>
|
|---|
| 44 |
|
|---|
| 45 | // import OLE support
|
|---|
| 46 | #include <win/wtypes.h>
|
|---|
| 47 | #define OLE_OK 0
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 | ODINDEBUGCHANNEL(SHLWAPI)
|
|---|
| 51 |
|
|---|
| 52 | #include "shlwapi.h"
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 | /*
|
|---|
| 56 | * This enables procedures to automatically take care or
|
|---|
| 57 | * required unicode conversion or not.
|
|---|
| 58 | */
|
|---|
| 59 | static BOOL flagOsIsUnicode = FALSE;
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 | BOOL VERSION_OsIsUnicode(VOID)
|
|---|
| 63 | {
|
|---|
| 64 | return flagOsIsUnicode;
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 | // ----------------------------------------------------------------------
|
|---|
| 69 | // WINE_StringFromCLSID
|
|---|
| 70 | // ----------------------------------------------------------------------
|
|---|
| 71 | HRESULT WINAPI WINE_StringFromCLSID(const CLSID *rclsid, LPSTR idstr)
|
|---|
| 72 | {
|
|---|
| 73 | // dprintf(("OLE32: WINE_StringFromCLSID"));
|
|---|
| 74 |
|
|---|
| 75 | if (rclsid == NULL)
|
|---|
| 76 | {
|
|---|
| 77 | dprintf((" clsid: (NULL)"));
|
|---|
| 78 | *idstr = 0;
|
|---|
| 79 | return E_FAIL;
|
|---|
| 80 | }
|
|---|
| 81 |
|
|---|
| 82 | // Setup new string...
|
|---|
| 83 | sprintf(idstr, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
|
|---|
| 84 | rclsid->Data1,
|
|---|
| 85 | rclsid->Data2,
|
|---|
| 86 | rclsid->Data3,
|
|---|
| 87 | rclsid->Data4[0],
|
|---|
| 88 | rclsid->Data4[1],
|
|---|
| 89 | rclsid->Data4[2],
|
|---|
| 90 | rclsid->Data4[3],
|
|---|
| 91 | rclsid->Data4[4],
|
|---|
| 92 | rclsid->Data4[5],
|
|---|
| 93 | rclsid->Data4[6],
|
|---|
| 94 | rclsid->Data4[7]);
|
|---|
| 95 |
|
|---|
| 96 | // dprintf((" clsid: %s", idstr));
|
|---|
| 97 |
|
|---|
| 98 | return OLE_OK;
|
|---|
| 99 | }
|
|---|
| 100 |
|
|---|
| 101 | // ----------------------------------------------------------------------
|
|---|
| 102 | // StringFromGUID2
|
|---|
| 103 | // ----------------------------------------------------------------------
|
|---|
| 104 | int WINAPI StringFromGUID2(REFGUID rguid, LPOLESTR lpsz, int cbMax)
|
|---|
| 105 | {
|
|---|
| 106 | // NB cbMax is a CHARACTER count not a BYTE count... :-)
|
|---|
| 107 | char tmp[50];
|
|---|
| 108 | size_t strLen;
|
|---|
| 109 |
|
|---|
| 110 | // Setup new string...
|
|---|
| 111 | WINE_StringFromCLSID(rguid, tmp);
|
|---|
| 112 |
|
|---|
| 113 | strLen = (strlen(tmp) + 1);
|
|---|
| 114 | if (strLen > cbMax)
|
|---|
| 115 | strLen = cbMax;
|
|---|
| 116 |
|
|---|
| 117 | AsciiToUnicodeN(tmp, lpsz, strLen);
|
|---|
| 118 |
|
|---|
| 119 | return strLen; // Num CHARACTERS including 0 terminator
|
|---|
| 120 | }
|
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 | /*****************************************************************************
|
|---|
| 124 | * Name : DllGetVersion
|
|---|
| 125 | * Purpose : Return version information about the DLL used
|
|---|
| 126 | * Parameters:
|
|---|
| 127 | * Variables :
|
|---|
| 128 | * Result :
|
|---|
| 129 | * Remark : SHLWAPI.446
|
|---|
| 130 | * Status : UNTESTED
|
|---|
| 131 | *
|
|---|
| 132 | * Author :
|
|---|
| 133 | *****************************************************************************/
|
|---|
| 134 |
|
|---|
| 135 | typedef struct tagDLLVERSION
|
|---|
| 136 | {
|
|---|
| 137 | DWORD dwLength; // == 0x14
|
|---|
| 138 | DWORD dwMajorVersion;
|
|---|
| 139 | DWORD dwMinorVersion;
|
|---|
| 140 | DWORD dwRevision;
|
|---|
| 141 | DWORD dwBuildNumber;
|
|---|
| 142 | } DLLVERSION, *LPDLLVERSION;
|
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 | ODINFUNCTION1(DWORD, DllGetVersion,
|
|---|
| 146 | LPDLLVERSION, lpBuffer)
|
|---|
| 147 | {
|
|---|
| 148 | if (lpBuffer == NULL)
|
|---|
| 149 | return E_INVALIDARG; // error code: invalid parameters
|
|---|
| 150 |
|
|---|
| 151 | if (IsBadWritePtr(lpBuffer,
|
|---|
| 152 | 20))
|
|---|
| 153 | return E_INVALIDARG;
|
|---|
| 154 |
|
|---|
| 155 | if (lpBuffer->dwLength != sizeof(DLLVERSION))
|
|---|
| 156 | return E_INVALIDARG;
|
|---|
| 157 |
|
|---|
| 158 | // our current version is 5.0.2314.1000
|
|---|
| 159 | lpBuffer->dwMajorVersion = 5;
|
|---|
| 160 | //lpBuffer->dwMinorVersion = 0; // @@@PH not touched in windows code ?
|
|---|
| 161 | lpBuffer->dwRevision = 2314;
|
|---|
| 162 | lpBuffer->dwBuildNumber = 1;
|
|---|
| 163 |
|
|---|
| 164 | return ERROR_SUCCESS;
|
|---|
| 165 | }
|
|---|