Changeset 795 for trunk/src/shell32/new/regstream.cpp
- Timestamp:
- Sep 2, 1999, 7:25:19 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/shell32/new/regstream.cpp
r791 r795 17 17 #include "shell32_main.h" 18 18 19 #include <heapstring.h> 19 20 #include <misc.h> 20 21 … … 32 33 } ISHRegStream; 33 34 34 static struct ICOM_VTABLE(IStream) rstvt; 35 36 /************************************************************************** 37 * IStream_Constructor() 38 */ 39 IStream *IStream_Constructor(HKEY hKey, LPCSTR pszSubKey, LPCSTR pszValue, DWORD grfMode) 40 { ISHRegStream* rstr; 41 DWORD dwType; 42 43 rstr = (ISHRegStream*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ISHRegStream)); 44 rstr->lpvtbl=&rstvt; 45 rstr->ref = 1; 46 47 if ( ERROR_SUCCESS == RegOpenKeyExA (hKey, pszSubKey, 0, KEY_READ, &(rstr->hKey))) 48 { if ( ERROR_SUCCESS == RegQueryValueExA(rstr->hKey, (LPSTR)pszValue,0,0,0,&(rstr->dwLength))) 49 { 50 /* read the binary data into the buffer */ 51 rstr->pbBuffer = HeapAlloc(GetProcessHeap(),0,rstr->dwLength); 52 if (rstr->pbBuffer) 53 { if ( ERROR_SUCCESS == RegQueryValueExA(rstr->hKey, (LPSTR)pszValue,0,&dwType,rstr->pbBuffer,&(rstr->dwLength))) 54 { if (dwType == REG_BINARY ) 55 { rstr->pszSubKey = HEAP_strdupA (GetProcessHeap(),0, pszSubKey); 56 rstr->pszValue = HEAP_strdupA (GetProcessHeap(),0, pszValue); 57 TRACE("(%p)->0x%08x,%s,%s,0x%08lx\n", rstr, hKey, pszSubKey, pszValue, grfMode); 58 shell32_ObjCount++; 59 return (IStream*)rstr; 60 } 61 } 62 HeapFree (GetProcessHeap(),0,rstr->pbBuffer); 63 } 64 } 65 RegCloseKey(rstr->hKey); 66 67 } 68 HeapFree (GetProcessHeap(),0,rstr); 69 return NULL; 70 } 35 //static struct ICOM_VTABLE(IStream) rstvt; 36 71 37 72 38 /************************************************************************** … … 274 240 }; 275 241 242 /************************************************************************** 243 * IStream_Constructor() 244 */ 245 IStream *IStream_Constructor(HKEY hKey, LPCSTR pszSubKey, LPCSTR pszValue, DWORD grfMode) 246 { ISHRegStream* rstr; 247 DWORD dwType; 248 249 rstr = (ISHRegStream*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ISHRegStream)); 250 rstr->lpvtbl=&rstvt; 251 rstr->ref = 1; 252 253 if ( ERROR_SUCCESS == RegOpenKeyExA (hKey, pszSubKey, 0, KEY_READ, &(rstr->hKey))) 254 { if ( ERROR_SUCCESS == RegQueryValueExA(rstr->hKey, (LPSTR)pszValue,0,0,0,&(rstr->dwLength))) 255 { 256 /* read the binary data into the buffer */ 257 rstr->pbBuffer = (BYTE*)HeapAlloc(GetProcessHeap(),0,rstr->dwLength); 258 if (rstr->pbBuffer) 259 { if ( ERROR_SUCCESS == RegQueryValueExA(rstr->hKey, (LPSTR)pszValue,0,&dwType,rstr->pbBuffer,&(rstr->dwLength))) 260 { if (dwType == REG_BINARY ) 261 { rstr->pszSubKey = HEAP_strdupA (GetProcessHeap(),0, pszSubKey); 262 rstr->pszValue = HEAP_strdupA (GetProcessHeap(),0, pszValue); 263 TRACE("(%p)->0x%08x,%s,%s,0x%08lx\n", rstr, hKey, pszSubKey, pszValue, grfMode); 264 shell32_ObjCount++; 265 return (IStream*)rstr; 266 } 267 } 268 HeapFree (GetProcessHeap(),0,rstr->pbBuffer); 269 } 270 } 271 RegCloseKey(rstr->hKey); 272 273 } 274 HeapFree (GetProcessHeap(),0,rstr); 275 return NULL; 276 } 277 278 276 279 /************************************************************************* 277 280 * OpenRegStream [SHELL32.85]
Note:
See TracChangeset
for help on using the changeset viewer.