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
0a645e8c
Commit
0a645e8c
authored
Jun 20, 2005
by
Robert Shearman
Committed by
Alexandre Julliard
Jun 20, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert some registry helper functions to use unicode versions of
CLSID & registry functions (untested).
parent
33a82558
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
54 deletions
+48
-54
compobj.c
dlls/ole32/compobj.c
+30
-32
ole16.c
dlls/ole32/ole16.c
+10
-15
ole2.c
dlls/ole32/ole2.c
+8
-7
No files found.
dlls/ole32/compobj.c
View file @
0a645e8c
...
...
@@ -2168,28 +2168,27 @@ HRESULT WINAPI CoSetState(IUnknown * pv)
*/
HRESULT
WINAPI
OleGetAutoConvert
(
REFCLSID
clsidOld
,
LPCLSID
pClsidNew
)
{
HKEY
hkey
=
0
;
char
buf
[
200
]
;
WCHAR
wbuf
[
200
];
static
const
WCHAR
wszAutoConvertTo
[]
=
{
'A'
,
'u'
,
't'
,
'o'
,
'C'
,
'o'
,
'n'
,
'v'
,
'e'
,
'r'
,
't'
,
'T'
,
'o'
,
0
}
;
HKEY
hkey
=
NULL
;
WCHAR
buf
[
CHARS_IN_GUID
];
DWORD
len
;
HRESULT
res
=
S_OK
;
sprintf
(
buf
,
"CLSID
\\
"
);
WINE_StringFromCLSID
(
clsidOld
,
&
buf
[
6
]);
if
(
RegOpenKeyA
(
HKEY_CLASSES_ROOT
,
buf
,
&
hkey
))
if
(
ERROR_SUCCESS
!=
COM_OpenKeyForCLSID
(
clsidOld
,
KEY_READ
,
&
hkey
))
{
res
=
REGDB_E_CLASSNOTREG
;
goto
done
;
goto
done
;
}
len
=
200
;
len
=
sizeof
(
buf
);
/* we can just query for the default value of AutoConvertTo key like that,
without opening the AutoConvertTo key and querying for NULL (default) */
if
(
RegQueryValue
A
(
hkey
,
"AutoConvertTo"
,
buf
,
&
len
))
if
(
RegQueryValue
W
(
hkey
,
wszAutoConvertTo
,
buf
,
&
len
))
{
res
=
REGDB_E_KEYMISSING
;
goto
done
;
goto
done
;
}
MultiByteToWideChar
(
CP_ACP
,
0
,
buf
,
-
1
,
wbuf
,
sizeof
(
wbuf
)
/
sizeof
(
WCHAR
)
);
CLSIDFromString
(
wbuf
,
pClsidNew
);
res
=
CLSIDFromString
(
buf
,
pClsidNew
);
done:
if
(
hkey
)
RegCloseKey
(
hkey
);
return
res
;
...
...
@@ -2213,27 +2212,26 @@ done:
*/
HRESULT
WINAPI
CoTreatAsClass
(
REFCLSID
clsidOld
,
REFCLSID
clsidNew
)
{
HKEY
hkey
=
0
;
char
buf
[
47
];
char
szClsidNew
[
39
];
static
const
WCHAR
wszAutoTreatAs
[]
=
{
'A'
,
'u'
,
't'
,
'o'
,
'T'
,
'r'
,
'e'
,
'a'
,
't'
,
'A'
,
's'
,
0
};
static
const
WCHAR
wszTreatAs
[]
=
{
'T'
,
'r'
,
'e'
,
'a'
,
't'
,
'A'
,
's'
,
0
};
HKEY
hkey
=
NULL
;
WCHAR
szClsidNew
[
CHARS_IN_GUID
];
HRESULT
res
=
S_OK
;
char
auto_treat_as
[
39
];
WCHAR
auto_treat_as
[
CHARS_IN_GUID
];
LONG
auto_treat_as_size
=
sizeof
(
auto_treat_as
);
CLSID
id
;
sprintf
(
buf
,
"CLSID
\\
"
);
WINE_StringFromCLSID
(
clsidOld
,
&
buf
[
6
]);
WINE_StringFromCLSID
(
clsidNew
,
szClsidNew
);
if
(
RegOpenKeyA
(
HKEY_CLASSES_ROOT
,
buf
,
&
hkey
))
if
(
ERROR_SUCCESS
!=
COM_OpenKeyForCLSID
(
clsidOld
,
KEY_READ
|
KEY_WRITE
,
&
hkey
))
{
res
=
REGDB_E_CLASSNOTREG
;
goto
done
;
}
if
(
!
memcmp
(
clsidOld
,
clsidNew
,
sizeof
(
*
clsidOld
)
))
{
if
(
!
RegQueryValue
A
(
hkey
,
"AutoTreatAs"
,
auto_treat_as
,
&
auto_treat_as_size
)
&&
!
__CLSIDFromStringA
(
auto_treat_as
,
&
id
))
if
(
!
RegQueryValue
W
(
hkey
,
wszAutoTreatAs
,
auto_treat_as
,
&
auto_treat_as_size
)
&&
!
CLSIDFromString
(
auto_treat_as
,
&
id
))
{
if
(
RegSetValue
A
(
hkey
,
"TreatAs"
,
REG_SZ
,
auto_treat_as
,
strlen
(
auto_treat_as
)
+
1
))
if
(
RegSetValue
W
(
hkey
,
wszTreatAs
,
REG_SZ
,
auto_treat_as
,
sizeof
(
auto_treat_as
)
))
{
res
=
REGDB_E_WRITEREGDB
;
goto
done
;
...
...
@@ -2241,13 +2239,14 @@ HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)
}
else
{
RegDeleteKey
A
(
hkey
,
"TreatAs"
);
RegDeleteKey
W
(
hkey
,
wszTreatAs
);
goto
done
;
}
}
else
if
(
RegSetValueA
(
hkey
,
"TreatAs"
,
REG_SZ
,
szClsidNew
,
strlen
(
szClsidNew
)
+
1
))
else
if
(
!
StringFromGUID2
(
clsidNew
,
szClsidNew
,
ARRAYSIZE
(
szClsidNew
))
&&
!
RegSetValueW
(
hkey
,
wszTreatAs
,
REG_SZ
,
szClsidNew
,
sizeof
(
szClsidNew
)))
{
res
=
REGDB_E_WRITEREGDB
;
res
=
REGDB_E_WRITEREGDB
;
goto
done
;
}
...
...
@@ -2274,32 +2273,31 @@ done:
*/
HRESULT
WINAPI
CoGetTreatAsClass
(
REFCLSID
clsidOld
,
LPCLSID
clsidNew
)
{
HKEY
hkey
=
0
;
char
buf
[
200
],
szClsidNew
[
200
];
static
const
WCHAR
wszTreatAs
[]
=
{
'T'
,
'r'
,
'e'
,
'a'
,
't'
,
'A'
,
's'
,
0
};
HKEY
hkey
=
NULL
;
WCHAR
szClsidNew
[
CHARS_IN_GUID
];
HRESULT
res
=
S_OK
;
LONG
len
=
sizeof
(
szClsidNew
);
FIXME
(
"(%s,%p)
\n
"
,
debugstr_guid
(
clsidOld
),
clsidNew
);
sprintf
(
buf
,
"CLSID
\\
"
);
WINE_StringFromCLSID
(
clsidOld
,
&
buf
[
6
]);
memcpy
(
clsidNew
,
clsidOld
,
sizeof
(
CLSID
));
/* copy over old value */
if
(
RegOpenKeyA
(
HKEY_CLASSES_ROOT
,
buf
,
&
hkey
))
if
(
COM_OpenKeyForCLSID
(
clsidOld
,
KEY_READ
,
&
hkey
))
{
res
=
REGDB_E_CLASSNOTREG
;
goto
done
;
}
if
(
RegQueryValue
A
(
hkey
,
"TreatAs"
,
szClsidNew
,
&
len
))
if
(
RegQueryValue
W
(
hkey
,
wszTreatAs
,
szClsidNew
,
&
len
))
{
res
=
S_FALSE
;
goto
done
;
}
res
=
__CLSIDFromStringA
(
szClsidNew
,
clsidNew
);
res
=
CLSIDFromString
(
szClsidNew
,
clsidNew
);
if
(
FAILED
(
res
))
FIXME
(
"Failed CLSIDFromStringA(%s), hres %lx?
\n
"
,
szClsidNew
,
res
);
ERR
(
"Failed CLSIDFromStringA(%s), hres 0x%08lx
\n
"
,
debugstr_w
(
szClsidNew
),
res
);
done:
if
(
hkey
)
RegCloseKey
(
hkey
);
return
res
;
}
/******************************************************************************
...
...
dlls/ole32/ole16.c
View file @
0a645e8c
...
...
@@ -356,23 +356,22 @@ HRESULT WINAPI ProgIDFromCLSID16(
REFCLSID
clsid
,
/* [in] class id as found in registry */
LPOLESTR16
*
lplpszProgID
/* [out] associated Prog ID */
)
{
char
strCLSID
[
50
],
*
buf
,
*
buf2
;
DWORD
buf2len
;
static
const
WCHAR
wszProgID
[]
=
{
'P'
,
'r'
,
'o'
,
'g'
,
'I'
,
'D'
,
0
};
HKEY
xhkey
;
HKEY
hkey
;
HRESULT
ret
=
S_OK
;
WINE_StringFromCLSID
(
clsid
,
strCLSID
);
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
strCLSID
)
+
14
);
sprintf
(
buf
,
"CLSID
\\
%s
\\
ProgID"
,
strCLSID
);
if
(
RegOpenKeyA
(
HKEY_CLASSES_ROOT
,
buf
,
&
xhkey
))
if
(
COM_OpenKeyForCLSID
(
clsid
,
KEY_READ
,
&
hkey
))
ret
=
REGDB_E_CLASSNOTREG
;
if
((
ret
==
S_OK
)
&&
RegOpenKeyW
(
hkey
,
wszProgID
,
&
xhkey
))
ret
=
REGDB_E_CLASSNOTREG
;
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
if
(
ret
==
S_OK
)
{
buf2
=
HeapAlloc
(
GetProcessHeap
(),
0
,
255
);
DWORD
buf2len
;
char
*
buf2
=
HeapAlloc
(
GetProcessHeap
(),
0
,
255
);
buf2len
=
255
;
if
(
RegQueryValueA
(
xhkey
,
NULL
,
buf2
,
&
buf2len
))
ret
=
REGDB_E_CLASSNOTREG
;
...
...
@@ -429,12 +428,8 @@ HRESULT WINAPI CoRegisterClassObject16(
DWORD
flags
,
/* [in] REGCLS flags indicating how connections are made */
LPDWORD
lpdwRegister
)
{
char
buf
[
80
];
WINE_StringFromCLSID
(
rclsid
,
buf
);
FIXME
(
"(%s,%p,0x%08lx,0x%08lx,%p),stub
\n
"
,
buf
,
pUnk
,
dwClsContext
,
flags
,
lpdwRegister
debugstr_guid
(
rclsid
)
,
pUnk
,
dwClsContext
,
flags
,
lpdwRegister
);
return
0
;
}
...
...
dlls/ole32/ole2.c
View file @
0a645e8c
...
...
@@ -46,6 +46,7 @@
#include "ole2ver.h"
#include "wownt32.h"
#include "wine/unicode.h"
#include "wine/winbase16.h"
#include "wine/wingdi16.h"
#include "wine/winuser16.h"
...
...
@@ -2294,20 +2295,20 @@ HRESULT WINAPI OleCreate(
*/
HRESULT
WINAPI
OleSetAutoConvert
(
REFCLSID
clsidOld
,
REFCLSID
clsidNew
)
{
HKEY
hkey
=
0
;
char
buf
[
200
],
szClsidNew
[
200
];
static
const
WCHAR
wszAutoConvertTo
[]
=
{
'A'
,
'u'
,
't'
,
'o'
,
'C'
,
'o'
,
'n'
,
'v'
,
'e'
,
'r'
,
't'
,
'T'
,
'o'
,
0
};
HKEY
hkey
=
NULL
;
WCHAR
szClsidNew
[
CHARS_IN_GUID
];
HRESULT
res
=
S_OK
;
/* FIXME: convert to Unicode */
TRACE
(
"(%s,%s)
\n
"
,
debugstr_guid
(
clsidOld
),
debugstr_guid
(
clsidNew
));
sprintf
(
buf
,
"CLSID
\\
"
);
WINE_StringFromCLSID
(
clsidOld
,
&
buf
[
6
]);
WINE_StringFromCLSID
(
clsidNew
,
szClsidNew
);
if
(
RegOpenKeyA
(
HKEY_CLASSES_ROOT
,
buf
,
&
hkey
))
if
(
COM_OpenKeyForCLSID
(
clsidOld
,
KEY_READ
|
KEY_WRITE
,
&
hkey
))
{
res
=
REGDB_E_CLASSNOTREG
;
goto
done
;
}
if
(
RegSetValueA
(
hkey
,
"AutoConvertTo"
,
REG_SZ
,
szClsidNew
,
strlen
(
szClsidNew
)
+
1
))
StringFromGUID2
(
clsidNew
,
szClsidNew
,
CHARS_IN_GUID
);
if
(
RegSetValueW
(
hkey
,
wszAutoConvertTo
,
REG_SZ
,
szClsidNew
,
(
strlenW
(
szClsidNew
)
+
1
)
*
sizeof
(
WCHAR
)))
{
res
=
REGDB_E_WRITEREGDB
;
goto
done
;
...
...
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