| 1 | /* $Id: ole32.c,v 1.1 2002-11-12 17:06:30 sandervl Exp $ */
|
|---|
| 2 | /*
|
|---|
| 3 | *
|
|---|
| 4 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 5 | *
|
|---|
| 6 | */
|
|---|
| 7 | /*
|
|---|
| 8 | * COM/OLE misc. functions.
|
|---|
| 9 | *
|
|---|
| 10 | * 1/7/99
|
|---|
| 11 | *
|
|---|
| 12 | * Copyright 1999 David J. Raison
|
|---|
| 13 | *
|
|---|
| 14 | * Some portions from Wine Implementation
|
|---|
| 15 | * Copyright 1995 Martin von Loewis
|
|---|
| 16 | * Copyright 1998 Justin Bradford
|
|---|
| 17 | * Copyright 1999 Francis Beaudet
|
|---|
| 18 | * Copyright 1999 Sylvain St-Germain
|
|---|
| 19 | */
|
|---|
| 20 |
|
|---|
| 21 | #include "ole32.h"
|
|---|
| 22 | #include "compobj_private.h"
|
|---|
| 23 |
|
|---|
| 24 | // ----------------------------------------------------------------------
|
|---|
| 25 | // CoDosDateTimeToFileTime
|
|---|
| 26 | // ----------------------------------------------------------------------
|
|---|
| 27 | BOOL WIN32API CoDosDateTimeToFileTime(WORD nDosDate, WORD nDosTime,
|
|---|
| 28 | FILETIME *lpFileTime)
|
|---|
| 29 | {
|
|---|
| 30 | dprintf(("OLE32: CoDosDateTimeToFileTime"));
|
|---|
| 31 |
|
|---|
| 32 | return DosDateTimeToFileTime(nDosDate, nDosTime, lpFileTime);
|
|---|
| 33 | }
|
|---|
| 34 |
|
|---|
| 35 | // ----------------------------------------------------------------------
|
|---|
| 36 | // CoDosDateTimeToFileTime
|
|---|
| 37 | // ----------------------------------------------------------------------
|
|---|
| 38 | BOOL WIN32API CoFileTimeToDosDateTime(FILETIME *lpFileTime, LPWORD lpDosDate,
|
|---|
| 39 | LPWORD lpDosTime)
|
|---|
| 40 | {
|
|---|
| 41 | dprintf(("OLE32: CoFileTimeToDosDateTime"));
|
|---|
| 42 |
|
|---|
| 43 | return FileTimeToDosDateTime(lpFileTime, lpDosDate, lpDosTime);
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 | // ----------------------------------------------------------------------
|
|---|
| 47 | // CLSIDFromStringA()
|
|---|
| 48 | // @@@PH: this is not a WINE API, but a replacement for CLSIDFromString16
|
|---|
| 49 | // which used to accept ASCII strings instead of OLE strings
|
|---|
| 50 | // ----------------------------------------------------------------------
|
|---|
| 51 |
|
|---|
| 52 | HRESULT WIN32API CLSIDFromStringA(
|
|---|
| 53 | LPCSTR lpsz, // [in] - ASCII string CLSID
|
|---|
| 54 | LPCLSID pclsid) // [out] - Binary CLSID
|
|---|
| 55 | {
|
|---|
| 56 | return CLSIDFromString16(lpsz, pclsid);
|
|---|
| 57 | }
|
|---|
| 58 |
|
|---|
| 59 | /******************************************************************************
|
|---|
| 60 | * CLSIDFromProgID [COMPOBJ.61]
|
|---|
| 61 | * Converts a program id into the respective GUID. (By using a registry lookup)
|
|---|
| 62 | * RETURNS
|
|---|
| 63 | * riid associated with the progid
|
|---|
| 64 | */
|
|---|
| 65 | HRESULT WINAPI CLSIDFromProgID16(
|
|---|
| 66 | LPCOLESTR16 progid, /* [in] program id as found in registry */
|
|---|
| 67 | LPCLSID riid /* [out] associated CLSID */
|
|---|
| 68 | ) {
|
|---|
| 69 | char *buf,buf2[80];
|
|---|
| 70 | DWORD buf2len;
|
|---|
| 71 | HRESULT err;
|
|---|
| 72 | HKEY xhkey;
|
|---|
| 73 |
|
|---|
| 74 | buf = HeapAlloc(GetProcessHeap(),0,strlen(progid)+8);
|
|---|
| 75 | sprintf(buf,"%s\\CLSID",progid);
|
|---|
| 76 | if ((err=RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&xhkey))) {
|
|---|
| 77 | HeapFree(GetProcessHeap(),0,buf);
|
|---|
| 78 | return CO_E_CLASSSTRING;
|
|---|
| 79 | }
|
|---|
| 80 | HeapFree(GetProcessHeap(),0,buf);
|
|---|
| 81 | buf2len = sizeof(buf2);
|
|---|
| 82 | if ((err=RegQueryValueA(xhkey,NULL,buf2,&buf2len))) {
|
|---|
| 83 | RegCloseKey(xhkey);
|
|---|
| 84 | return CO_E_CLASSSTRING;
|
|---|
| 85 | }
|
|---|
| 86 | RegCloseKey(xhkey);
|
|---|
| 87 | return __CLSIDFromStringA(buf2,riid);
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | /******************************************************************************
|
|---|
| 91 | * CLSIDFromString [COMPOBJ.20]
|
|---|
| 92 | * Converts a unique identifier from its string representation into
|
|---|
| 93 | * the GUID struct.
|
|---|
| 94 | *
|
|---|
| 95 | * Class id: DWORD-WORD-WORD-BYTES[2]-BYTES[6]
|
|---|
| 96 | *
|
|---|
| 97 | * RETURNS
|
|---|
| 98 | * the converted GUID
|
|---|
| 99 | */
|
|---|
| 100 | HRESULT WINAPI CLSIDFromString16(
|
|---|
| 101 | LPCOLESTR16 idstr, /* [in] string representation of guid */
|
|---|
| 102 | CLSID *id) /* [out] GUID converted from string */
|
|---|
| 103 | {
|
|---|
| 104 |
|
|---|
| 105 | return __CLSIDFromStringA(idstr,id);
|
|---|
| 106 | }
|
|---|