Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
cb83957e
Commit
cb83957e
authored
Sep 28, 2009
by
Peter Oberndorfer
Committed by
Alexandre Julliard
Sep 29, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Write back data to registry when closing reg stream.
parent
90e800cf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
12 deletions
+69
-12
regstream.c
dlls/shlwapi/regstream.c
+69
-12
No files found.
dlls/shlwapi/regstream.c
View file @
cb83957e
...
...
@@ -43,6 +43,12 @@ typedef struct
LPBYTE
pbBuffer
;
DWORD
dwLength
;
DWORD
dwPos
;
DWORD
dwMode
;
union
{
LPSTR
keyNameA
;
LPWSTR
keyNameW
;
}
u
;
BOOL
bUnicode
;
}
ISHRegStream
;
/**************************************************************************
...
...
@@ -98,11 +104,34 @@ static ULONG WINAPI IStream_fnRelease(IStream *iface)
{
TRACE
(
" destroying SHReg IStream (%p)
\n
"
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pbBuffer
);
if
(
This
->
hKey
)
{
/* write back data in REG_BINARY */
if
(
This
->
dwMode
==
STGM_READWRITE
||
This
->
dwMode
==
STGM_WRITE
)
{
if
(
This
->
dwLength
)
{
if
(
This
->
bUnicode
)
RegSetValueExW
(
This
->
hKey
,
This
->
u
.
keyNameW
,
0
,
REG_BINARY
,
(
const
BYTE
*
)
This
->
pbBuffer
,
This
->
dwLength
);
else
RegSetValueExA
(
This
->
hKey
,
This
->
u
.
keyNameA
,
0
,
REG_BINARY
,
(
const
BYTE
*
)
This
->
pbBuffer
,
This
->
dwLength
);
}
else
{
if
(
This
->
bUnicode
)
RegDeleteValueW
(
This
->
hKey
,
This
->
u
.
keyNameW
);
else
RegDeleteValueA
(
This
->
hKey
,
This
->
u
.
keyNameA
);
}
}
RegCloseKey
(
This
->
hKey
);
}
HeapFree
(
GetProcessHeap
(),
0
,
This
->
u
.
keyNameA
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pbBuffer
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
0
;
}
...
...
@@ -296,7 +325,7 @@ static HRESULT WINAPI IStream_fnStat (IStream * iface, STATSTG* pstatstg, DWORD
pstatstg
->
ctime
.
dwLowDateTime
=
0
;
pstatstg
->
atime
.
dwHighDateTime
=
0
;
pstatstg
->
atime
.
dwLowDateTime
=
0
;
pstatstg
->
grfMode
=
STGM_READWRITE
;
pstatstg
->
grfMode
=
This
->
dwMode
;
pstatstg
->
grfLocksSupported
=
0
;
pstatstg
->
clsid
=
CLSID_NULL
;
pstatstg
->
grfStateBits
=
0
;
...
...
@@ -395,7 +424,10 @@ static ISHRegStream rsDummyRegStream =
NULL
,
NULL
,
0
,
0
0
,
STGM_READWRITE
,
{
NULL
},
FALSE
};
/**************************************************************************
...
...
@@ -403,7 +435,7 @@ static ISHRegStream rsDummyRegStream =
*
* Internal helper: Create and initialise a new registry stream object.
*/
static
IStream
*
IStream_Create
(
HKEY
hKey
,
LPBYTE
pbBuffer
,
DWORD
dwLength
)
static
IS
HRegS
tream
*
IStream_Create
(
HKEY
hKey
,
LPBYTE
pbBuffer
,
DWORD
dwLength
)
{
ISHRegStream
*
regStream
;
...
...
@@ -417,9 +449,12 @@ static IStream *IStream_Create(HKEY hKey, LPBYTE pbBuffer, DWORD dwLength)
regStream
->
pbBuffer
=
pbBuffer
;
regStream
->
dwLength
=
dwLength
;
regStream
->
dwPos
=
0
;
regStream
->
dwMode
=
STGM_READWRITE
;
regStream
->
u
.
keyNameA
=
NULL
;
regStream
->
bUnicode
=
FALSE
;
}
TRACE
(
"Returning %p
\n
"
,
regStream
);
return
(
IStream
*
)
regStream
;
return
regStream
;
}
/*************************************************************************
...
...
@@ -440,7 +475,7 @@ static IStream *IStream_Create(HKEY hKey, LPBYTE pbBuffer, DWORD dwLength)
IStream
*
WINAPI
SHOpenRegStream2A
(
HKEY
hKey
,
LPCSTR
pszSubkey
,
LPCSTR
pszValue
,
DWORD
dwMode
)
{
IStream
*
tmp
;
IS
HRegS
tream
*
tmp
;
HKEY
hStrKey
=
NULL
;
LPBYTE
lpBuff
=
NULL
;
DWORD
dwLength
=
0
;
...
...
@@ -470,8 +505,19 @@ IStream * WINAPI SHOpenRegStream2A(HKEY hKey, LPCSTR pszSubkey,
lpBuff
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwLength
);
tmp
=
IStream_Create
(
hStrKey
,
lpBuff
,
dwLength
);
if
(
tmp
)
{
if
(
pszValue
)
{
int
len
=
lstrlenA
(
pszValue
)
+
1
;
tmp
->
u
.
keyNameA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
memcpy
(
tmp
->
u
.
keyNameA
,
pszValue
,
len
);
}
return
tmp
;
tmp
->
dwMode
=
dwMode
;
tmp
->
bUnicode
=
FALSE
;
return
(
IStream
*
)
tmp
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
lpBuff
);
...
...
@@ -488,7 +534,7 @@ IStream * WINAPI SHOpenRegStream2A(HKEY hKey, LPCSTR pszSubkey,
IStream
*
WINAPI
SHOpenRegStream2W
(
HKEY
hKey
,
LPCWSTR
pszSubkey
,
LPCWSTR
pszValue
,
DWORD
dwMode
)
{
IStream
*
tmp
;
IS
HRegS
tream
*
tmp
;
HKEY
hStrKey
=
NULL
;
LPBYTE
lpBuff
=
NULL
;
DWORD
dwLength
=
0
;
...
...
@@ -519,8 +565,19 @@ IStream * WINAPI SHOpenRegStream2W(HKEY hKey, LPCWSTR pszSubkey,
lpBuff
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwLength
);
tmp
=
IStream_Create
(
hStrKey
,
lpBuff
,
dwLength
);
if
(
tmp
)
{
if
(
pszValue
)
{
int
len
=
lstrlenW
(
pszValue
)
+
1
;
tmp
->
u
.
keyNameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
memcpy
(
tmp
->
u
.
keyNameW
,
pszValue
,
len
*
sizeof
(
WCHAR
));
}
return
tmp
;
tmp
->
dwMode
=
dwMode
;
tmp
->
bUnicode
=
TRUE
;
return
(
IStream
*
)
tmp
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
lpBuff
);
...
...
@@ -604,7 +661,7 @@ IStream * WINAPI SHCreateMemStream(const BYTE *lpbData, UINT dwDataLen)
if
(
lpbDup
)
{
memcpy
(
lpbDup
,
lpbData
,
dwDataLen
);
iStrmRet
=
IStream_Create
(
NULL
,
lpbDup
,
dwDataLen
);
iStrmRet
=
(
IStream
*
)
IStream_Create
(
NULL
,
lpbDup
,
dwDataLen
);
if
(
!
iStrmRet
)
HeapFree
(
GetProcessHeap
(),
0
,
lpbDup
);
...
...
@@ -642,7 +699,7 @@ HRESULT WINAPI SHCreateStreamWrapper(LPBYTE lpbData, DWORD dwDataLen,
if
(
dwReserved
||
!
lppStream
)
return
E_INVALIDARG
;
lpStream
=
IStream_Create
(
NULL
,
lpbData
,
dwDataLen
);
lpStream
=
(
IStream
*
)
IStream_Create
(
NULL
,
lpbData
,
dwDataLen
);
if
(
!
lpStream
)
return
E_OUTOFMEMORY
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment