summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/test/test_file_util_win.cc2
-rw-r--r--cloud_print/virtual_driver/win/port_monitor/port_monitor_unittest.cc6
-rw-r--r--net/base/keygen_handler_win.cc9
-rw-r--r--net/cert/cert_verify_proc_win.cc2
-rw-r--r--net/proxy/proxy_config_service_win_unittest.cc16
-rw-r--r--printing/backend/win_helper.cc8
-rw-r--r--remoting/base/dispatch_win.h56
-rw-r--r--remoting/base/dispatch_win.h.pump7
-rw-r--r--rlz/win/lib/rlz_lib_win.cc2
9 files changed, 68 insertions, 40 deletions
diff --git a/base/test/test_file_util_win.cc b/base/test/test_file_util_win.cc
index ae3f0d5..ea07177 100644
--- a/base/test/test_file_util_win.cc
+++ b/base/test/test_file_util_win.cc
@@ -47,7 +47,7 @@ bool DenyFilePermission(const FilePath& path, DWORD permission) {
change.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
change.Trustee.TrusteeForm = TRUSTEE_IS_NAME;
change.Trustee.TrusteeType = TRUSTEE_IS_USER;
- change.Trustee.ptstrName = L"CURRENT_USER";
+ change.Trustee.ptstrName = const_cast<wchar_t*>(L"CURRENT_USER");
PACL new_dacl;
if (SetEntriesInAcl(1, &change, old_dacl, &new_dacl) != ERROR_SUCCESS) {
diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor_unittest.cc b/cloud_print/virtual_driver/win/port_monitor/port_monitor_unittest.cc
index 335503a..a4b2e0c 100644
--- a/cloud_print/virtual_driver/win/port_monitor/port_monitor_unittest.cc
+++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor_unittest.cc
@@ -236,7 +236,8 @@ TEST_F(PortMonitorTest, FlowTest) {
EXPECT_TRUE(monitor2->pfnEndDocPort != NULL);
// These functions should fail if we have not impersonated the user.
- EXPECT_FALSE(monitor2->pfnStartDocPort(port_handle, L"", 0, 0, NULL));
+ EXPECT_FALSE(monitor2->pfnStartDocPort(
+ port_handle, const_cast<wchar_t*>(L""), 0, 0, NULL));
EXPECT_FALSE(monitor2->pfnWritePort(port_handle,
buffer,
kBufferSize,
@@ -251,7 +252,8 @@ TEST_F(PortMonitorTest, FlowTest) {
// Now impersonate so we can test the success case.
ASSERT_TRUE(ImpersonateSelf(SecurityImpersonation));
- EXPECT_TRUE(monitor2->pfnStartDocPort(port_handle, L"", 0, 0, NULL));
+ EXPECT_TRUE(monitor2->pfnStartDocPort(
+ port_handle, const_cast<wchar_t*>(L""), 0, 0, NULL));
EXPECT_TRUE(monitor2->pfnWritePort(port_handle,
buffer,
kBufferSize,
diff --git a/net/base/keygen_handler_win.cc b/net/base/keygen_handler_win.cc
index 59dc69d..f97ada7 100644
--- a/net/base/keygen_handler_win.cc
+++ b/net/base/keygen_handler_win.cc
@@ -36,7 +36,8 @@ bool GetSubjectPublicKeyInfo(HCRYPTPROV prov, std::vector<BYTE>* output) {
// as a CERT_PUBLIC_KEY_INFO structure. Currently, only RSA public keys are
// supported.
ok = CryptExportPublicKeyInfoEx(prov, AT_KEYEXCHANGE, X509_ASN_ENCODING,
- szOID_RSA_RSA, 0, NULL, NULL, &size);
+ const_cast<char*>(szOID_RSA_RSA), 0, NULL,
+ NULL, &size);
DCHECK(ok);
if (!ok)
return false;
@@ -46,8 +47,8 @@ bool GetSubjectPublicKeyInfo(HCRYPTPROV prov, std::vector<BYTE>* output) {
PCERT_PUBLIC_KEY_INFO public_key_casted =
reinterpret_cast<PCERT_PUBLIC_KEY_INFO>(&(*output)[0]);
ok = CryptExportPublicKeyInfoEx(prov, AT_KEYEXCHANGE, X509_ASN_ENCODING,
- szOID_RSA_RSA, 0, NULL, public_key_casted,
- &size);
+ const_cast<char*>(szOID_RSA_RSA), 0, NULL,
+ public_key_casted, &size);
DCHECK(ok);
if (!ok)
return false;
@@ -82,7 +83,7 @@ bool GetSignedPublicKeyAndChallenge(HCRYPTPROV prov,
CRYPT_ALGORITHM_IDENTIFIER sig_alg;
memset(&sig_alg, 0, sizeof(sig_alg));
- sig_alg.pszObjId = szOID_RSA_MD5RSA;
+ sig_alg.pszObjId = const_cast<char*>(szOID_RSA_MD5RSA);
BOOL ok;
DWORD size = 0;
diff --git a/net/cert/cert_verify_proc_win.cc b/net/cert/cert_verify_proc_win.cc
index 8d0bb25..5807a5e 100644
--- a/net/cert/cert_verify_proc_win.cc
+++ b/net/cert/cert_verify_proc_win.cc
@@ -571,7 +571,7 @@ int CertVerifyProcWin::VerifyInternal(
// We still need to request szOID_SERVER_GATED_CRYPTO and szOID_SGC_NETSCAPE
// today because some certificate chains need them. IE also requests these
// two usages.
- static const LPSTR usage[] = {
+ static const LPCSTR usage[] = {
szOID_PKIX_KP_SERVER_AUTH,
szOID_SERVER_GATED_CRYPTO,
szOID_SGC_NETSCAPE
diff --git a/net/proxy/proxy_config_service_win_unittest.cc b/net/proxy/proxy_config_service_win_unittest.cc
index 911949d..f133500 100644
--- a/net/proxy/proxy_config_service_win_unittest.cc
+++ b/net/proxy/proxy_config_service_win_unittest.cc
@@ -12,9 +12,16 @@
namespace net {
TEST(ProxyConfigServiceWinTest, SetFromIEConfig) {
+ // Like WINHTTP_CURRENT_USER_IE_PROXY_CONFIG, but with const strings.
+ struct IEProxyConfig {
+ BOOL auto_detect;
+ const wchar_t* auto_config_url;
+ const wchar_t* proxy;
+ const wchar_t* proxy_bypass;
+ };
const struct {
// Input.
- WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_config;
+ IEProxyConfig ie_config;
// Expected outputs (fields of the ProxyConfig).
bool auto_detect;
@@ -190,8 +197,13 @@ TEST(ProxyConfigServiceWinTest, SetFromIEConfig) {
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
+ WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_config = {
+ tests[i].ie_config.auto_detect,
+ const_cast<wchar_t*>(tests[i].ie_config.auto_config_url),
+ const_cast<wchar_t*>(tests[i].ie_config.proxy),
+ const_cast<wchar_t*>(tests[i].ie_config.proxy_bypass)};
ProxyConfig config;
- ProxyConfigServiceWin::SetFromIEConfig(&config, tests[i].ie_config);
+ ProxyConfigServiceWin::SetFromIEConfig(&config, ie_config);
EXPECT_EQ(tests[i].auto_detect, config.auto_detect());
EXPECT_EQ(tests[i].pac_url, config.pac_url());
diff --git a/printing/backend/win_helper.cc b/printing/backend/win_helper.cc
index ac5892b..6aba7c6 100644
--- a/printing/backend/win_helper.cc
+++ b/printing/backend/win_helper.cc
@@ -472,14 +472,18 @@ scoped_ptr<DEVMODE, base::FreeDeleter> CreateDevModeWithColor(
scoped_ptr<DEVMODE, base::FreeDeleter> CreateDevMode(HANDLE printer,
DEVMODE* in) {
- LONG buffer_size = DocumentProperties(NULL, printer, L"", NULL, NULL, 0);
+ LONG buffer_size = DocumentProperties(
+ NULL, printer, const_cast<wchar_t*>(L""), NULL, NULL, 0);
if (buffer_size < static_cast<int>(sizeof(DEVMODE)))
return scoped_ptr<DEVMODE, base::FreeDeleter>();
scoped_ptr<DEVMODE, base::FreeDeleter> out(
reinterpret_cast<DEVMODE*>(malloc(buffer_size)));
DWORD flags = (in ? (DM_IN_BUFFER) : 0) | DM_OUT_BUFFER;
- if (DocumentProperties(NULL, printer, L"", out.get(), in, flags) != IDOK)
+ if (DocumentProperties(
+ NULL, printer, const_cast<wchar_t*>(L""), out.get(), in, flags) !=
+ IDOK) {
return scoped_ptr<DEVMODE, base::FreeDeleter>();
+ }
CHECK_GE(buffer_size, out.get()->dmSize + out.get()->dmDriverExtra);
return out.Pass();
}
diff --git a/remoting/base/dispatch_win.h b/remoting/base/dispatch_win.h
index 9578ab8..ccf5672 100644
--- a/remoting/base/dispatch_win.h
+++ b/remoting/base/dispatch_win.h
@@ -117,13 +117,14 @@ COMPILE_ASSERT(sizeof(ScopedVariantArg) == sizeof(VARIANTARG),
// - VARIANT is the only supported parameter type at the moment.
HRESULT Invoke(IDispatch* object,
- LPOLESTR name,
+ LPCOLESTR const_name,
WORD flags,
VARIANT* const & result_out) {
// Retrieve the ID of the method to be called.
DISPID disp_id;
- HRESULT hr = object->GetIDsOfNames(IID_NULL, &name, 1, LOCALE_USER_DEFAULT,
- &disp_id);
+ LPOLESTR name = const_cast<LPOLESTR>(const_name);
+ HRESULT hr = object->GetIDsOfNames(
+ IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &disp_id);
if (FAILED(hr))
return hr;
@@ -161,14 +162,15 @@ HRESULT Invoke(IDispatch* object,
template <typename P1>
HRESULT Invoke(IDispatch* object,
- LPOLESTR name,
+ LPCOLESTR const_name,
WORD flags,
const P1& p1,
VARIANT* const & result_out) {
// Retrieve the ID of the method to be called.
DISPID disp_id;
- HRESULT hr = object->GetIDsOfNames(IID_NULL, &name, 1, LOCALE_USER_DEFAULT,
- &disp_id);
+ LPOLESTR name = const_cast<LPOLESTR>(const_name);
+ HRESULT hr = object->GetIDsOfNames(
+ IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &disp_id);
if (FAILED(hr))
return hr;
@@ -213,15 +215,16 @@ HRESULT Invoke(IDispatch* object,
template <typename P1, typename P2>
HRESULT Invoke(IDispatch* object,
- LPOLESTR name,
+ LPCOLESTR const_name,
WORD flags,
const P1& p1,
const P2& p2,
VARIANT* const & result_out) {
// Retrieve the ID of the method to be called.
DISPID disp_id;
- HRESULT hr = object->GetIDsOfNames(IID_NULL, &name, 1, LOCALE_USER_DEFAULT,
- &disp_id);
+ LPOLESTR name = const_cast<LPOLESTR>(const_name);
+ HRESULT hr = object->GetIDsOfNames(
+ IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &disp_id);
if (FAILED(hr))
return hr;
@@ -270,7 +273,7 @@ HRESULT Invoke(IDispatch* object,
template <typename P1, typename P2, typename P3>
HRESULT Invoke(IDispatch* object,
- LPOLESTR name,
+ LPCOLESTR const_name,
WORD flags,
const P1& p1,
const P2& p2,
@@ -278,8 +281,9 @@ HRESULT Invoke(IDispatch* object,
VARIANT* const & result_out) {
// Retrieve the ID of the method to be called.
DISPID disp_id;
- HRESULT hr = object->GetIDsOfNames(IID_NULL, &name, 1, LOCALE_USER_DEFAULT,
- &disp_id);
+ LPOLESTR name = const_cast<LPOLESTR>(const_name);
+ HRESULT hr = object->GetIDsOfNames(
+ IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &disp_id);
if (FAILED(hr))
return hr;
@@ -332,7 +336,7 @@ HRESULT Invoke(IDispatch* object,
template <typename P1, typename P2, typename P3, typename P4>
HRESULT Invoke(IDispatch* object,
- LPOLESTR name,
+ LPCOLESTR const_name,
WORD flags,
const P1& p1,
const P2& p2,
@@ -341,8 +345,9 @@ HRESULT Invoke(IDispatch* object,
VARIANT* const & result_out) {
// Retrieve the ID of the method to be called.
DISPID disp_id;
- HRESULT hr = object->GetIDsOfNames(IID_NULL, &name, 1, LOCALE_USER_DEFAULT,
- &disp_id);
+ LPOLESTR name = const_cast<LPOLESTR>(const_name);
+ HRESULT hr = object->GetIDsOfNames(
+ IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &disp_id);
if (FAILED(hr))
return hr;
@@ -399,7 +404,7 @@ HRESULT Invoke(IDispatch* object,
template <typename P1, typename P2, typename P3, typename P4, typename P5>
HRESULT Invoke(IDispatch* object,
- LPOLESTR name,
+ LPCOLESTR const_name,
WORD flags,
const P1& p1,
const P2& p2,
@@ -409,8 +414,9 @@ HRESULT Invoke(IDispatch* object,
VARIANT* const & result_out) {
// Retrieve the ID of the method to be called.
DISPID disp_id;
- HRESULT hr = object->GetIDsOfNames(IID_NULL, &name, 1, LOCALE_USER_DEFAULT,
- &disp_id);
+ LPOLESTR name = const_cast<LPOLESTR>(const_name);
+ HRESULT hr = object->GetIDsOfNames(
+ IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &disp_id);
if (FAILED(hr))
return hr;
@@ -472,7 +478,7 @@ HRESULT Invoke(IDispatch* object,
template <typename P1, typename P2, typename P3, typename P4, typename P5,
typename P6>
HRESULT Invoke(IDispatch* object,
- LPOLESTR name,
+ LPCOLESTR const_name,
WORD flags,
const P1& p1,
const P2& p2,
@@ -483,8 +489,9 @@ HRESULT Invoke(IDispatch* object,
VARIANT* const & result_out) {
// Retrieve the ID of the method to be called.
DISPID disp_id;
- HRESULT hr = object->GetIDsOfNames(IID_NULL, &name, 1, LOCALE_USER_DEFAULT,
- &disp_id);
+ LPOLESTR name = const_cast<LPOLESTR>(const_name);
+ HRESULT hr = object->GetIDsOfNames(
+ IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &disp_id);
if (FAILED(hr))
return hr;
@@ -550,7 +557,7 @@ HRESULT Invoke(IDispatch* object,
template <typename P1, typename P2, typename P3, typename P4, typename P5,
typename P6, typename P7>
HRESULT Invoke(IDispatch* object,
- LPOLESTR name,
+ LPCOLESTR const_name,
WORD flags,
const P1& p1,
const P2& p2,
@@ -562,8 +569,9 @@ HRESULT Invoke(IDispatch* object,
VARIANT* const & result_out) {
// Retrieve the ID of the method to be called.
DISPID disp_id;
- HRESULT hr = object->GetIDsOfNames(IID_NULL, &name, 1, LOCALE_USER_DEFAULT,
- &disp_id);
+ LPOLESTR name = const_cast<LPOLESTR>(const_name);
+ HRESULT hr = object->GetIDsOfNames(
+ IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &disp_id);
if (FAILED(hr))
return hr;
diff --git a/remoting/base/dispatch_win.h.pump b/remoting/base/dispatch_win.h.pump
index c6a6d5a..6ef0890 100644
--- a/remoting/base/dispatch_win.h.pump
+++ b/remoting/base/dispatch_win.h.pump
@@ -128,7 +128,7 @@ $range ARG 1..ARITY
$if ARITY > 0 [[template <$for ARG , [[typename P$(ARG)]]>]]
HRESULT Invoke(IDispatch* object,
- LPOLESTR name,
+ LPCOLESTR const_name,
WORD flags,
$for ARG [[
@@ -138,8 +138,9 @@ $for ARG [[
VARIANT* const & result_out) {
// Retrieve the ID of the method to be called.
DISPID disp_id;
- HRESULT hr = object->GetIDsOfNames(IID_NULL, &name, 1, LOCALE_USER_DEFAULT,
- &disp_id);
+ LPOLESTR name = const_cast<LPOLESTR>(const_name);
+ HRESULT hr = object->GetIDsOfNames(
+ IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &disp_id);
if (FAILED(hr))
return hr;
diff --git a/rlz/win/lib/rlz_lib_win.cc b/rlz/win/lib/rlz_lib_win.cc
index c765560..1249fc3 100644
--- a/rlz/win/lib/rlz_lib_win.cc
+++ b/rlz/win/lib/rlz_lib_win.cc
@@ -153,7 +153,7 @@ bool CreateMachineState() {
ea.grfAccessMode = GRANT_ACCESS;
ea.grfInheritance= SUB_CONTAINERS_AND_OBJECTS_INHERIT;
ea.Trustee.TrusteeForm = TRUSTEE_IS_NAME;
- ea.Trustee.ptstrName = L"Everyone";
+ ea.Trustee.ptstrName = const_cast<wchar_t*>(L"Everyone");
ACL* new_dacl = NULL;
result = SetEntriesInAcl(1, &ea, dacl, &new_dacl);