Wine-devel
Threads by month
- ----- 2026 -----
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
November 2019
- 85 participants
- 778 discussions
v4: define WS macro for error free compilation
v3: fix definitions of in_addr and in6_addr
v2: fix build errors
Signed-off-by: Vijay Kiran Kamuju <infyquest(a)gmail.com>
---
include/ras.h | 343 +++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 295 insertions(+), 48 deletions(-)
diff --git a/include/ras.h b/include/ras.h
index a8c04da2b6db..afaacaed6e3b 100644
--- a/include/ras.h
+++ b/include/ras.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 1998 Marcus Meissner
+ * Copyright (C) 2019 Vijay Kiran Kamuju
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -28,16 +29,29 @@ extern "C" {
#include <inaddr.h>
#include <in6addr.h>
+typedef enum RASAPIVERSION
+{
+ RASAPIVERSION_500 = 1,
+ RASAPIVERSION_501,
+ RASAPIVERSION_600,
+ RASAPIVERSION_601,
+} RASAPIVERSION;
+
+#define RASAPIVERSION_CURRENT RASAPIVERSION_601
+
#define RAS_MaxCallbackNumber RAS_MaxPhoneNumber
#define RAS_MaxDeviceName 128
#define RAS_MaxDeviceType 16
#define RAS_MaxEntryName 256
#define RAS_MaxPhoneNumber 128
+#define RAS_MaxIpAddress 15
+#define RAS_MaxIpxAddress 21
#define RAS_MaxAreaCode 10
#define RAS_MaxPadType 32
#define RAS_MaxX25Address 200
#define RAS_MaxFacilities 200
#define RAS_MaxUserData 200
+#define RAS_MaxReplyMessage 1024
#define RAS_MaxDnsSuffix 256
/* szDeviceType strings for RASDEVINFO */
@@ -75,6 +89,31 @@ DECL_WINELIB_TYPE_AW(LPRASDEVINFO)
DECLARE_HANDLE(HRASCONN);
typedef HRASCONN* LPHRASCONN;
+#define RASCF_AllUsers 0x00000001
+#define RASCF_GlobalCreds 0x00000002
+#define RASCF_OwnerKnown 0x00000004
+#define RASCF_OwnerMatch 0x00000008
+
+#define RASCF_IsOwner(rascFlags) (((rascFlags) & (RASCF_OwnerKnown|RASCF_OwnerMatch)) == (RASCF_OwnerKnown|RASCF_OwnerMatch))
+#define RASCF_IsNotOwner(rascFlags) (((rascFlags) & (RASCF_OwnerKnown|RASCF_OwnerMatch)) == (RASCF_OwnerKnown))
+
+#define RDEOPT_UsePrefixSuffix 0x00000001
+#define RDEOPT_PausedStates 0x00000002
+#define RDEOPT_IgnoreModemSpeaker 0x00000004
+#define RDEOPT_SetModemSpeaker 0x00000008
+#define RDEOPT_IgnoreSoftwareCompression 0x00000010
+#define RDEOPT_SetSoftwareCompression 0x00000020
+#define RDEOPT_DisableConnectedUI 0x00000040
+#define RDEOPT_DisableReconnectUI 0x00000080
+#define RDEOPT_DisableReconnect 0x00000100
+#define RDEOPT_NoUser 0x00000200
+#define RDEOPT_PauseOnScript 0x00000400
+#define RDEOPT_Router 0x00000800
+#define RDEOPT_CustomDial 0x00001000
+#define RDEOPT_UseCustomScripting 0x00002000
+#define RDEOPT_InvokeAutoTriggerCredentialUI 0x00004000
+#define RDEOPT_EapInfoCryptInCapable 0x00008000
+
typedef struct tagRASCONNA {
DWORD dwSize;
HRASCONN hRasConn;
@@ -106,14 +145,20 @@ typedef struct tagRASCONNW {
DECL_WINELIB_TYPE_AW(RASCONN)
DECL_WINELIB_TYPE_AW(LPRASCONN)
+#define REN_User 0x00000000
+#define REN_AllUsers 0x00000001
typedef struct tagRASENTRYNAMEA {
DWORD dwSize;
CHAR szEntryName[ RAS_MaxEntryName + 1 ];
+ DWORD dwFlags;
+ CHAR szPhonebookPath[MAX_PATH + 1];
} RASENTRYNAMEA, *LPRASENTRYNAMEA;
typedef struct tagRASENTRYNAMEW {
DWORD dwSize;
WCHAR szEntryName[ RAS_MaxEntryName + 1 ];
+ DWORD dwFlags;
+ WCHAR szPhonebookPath[MAX_PATH + 1];
} RASENTRYNAMEW, *LPRASENTRYNAMEW;
DECL_WINELIB_TYPE_AW(RASENTRYNAME)
@@ -129,6 +174,8 @@ typedef struct tagRASDIALPARAMSA {
CHAR szDomain[ DNLEN + 1 ];
DWORD dwSubEntry;
DWORD dwCallbackId;
+ DWORD dwIfIndex;
+ LPSTR szEncPassword;
} RASDIALPARAMSA, *LPRASDIALPARAMSA;
typedef struct tagRASDIALPARAMSW {
@@ -141,31 +188,131 @@ typedef struct tagRASDIALPARAMSW {
WCHAR szDomain[ DNLEN + 1 ];
DWORD dwSubEntry;
DWORD dwCallbackId;
+ DWORD dwIfIndex;
+ LPWSTR szEncPassword;
} RASDIALPARAMSW, *LPRASDIALPARAMSW;
DECL_WINELIB_TYPE_AW(RASDIALPARAMS)
DECL_WINELIB_TYPE_AW(LPRASDIALPARAMS)
typedef struct tagRASIPADDR {
- BYTE classA,classB,classC,classD;
+ BYTE classA,classB,classC,classD;
} RASIPADDR;
-#define RASEO_UseCountryAndAreaCodes 0x0001
-#define RASEO_SpecificIpAddr 0x0002
-#define RASEO_SpecificNameServers 0x0004
-#define RASEO_IpHeaderCompression 0x0008
-#define RASEO_RemoteDefaultGateway 0x0010
-#define RASEO_DisableLcpExtensions 0x0020
-#define RASEO_TerminalBeforeDial 0x0040
-#define RASEO_TerminalAfterDial 0x0080
-#define RASEO_ModemLights 0x0100
-#define RASEO_SwCompression 0x0200
-#define RASEO_RequireEncryptedPw 0x0400
-#define RASEO_RequireMsEncryptedPw 0x0800
-#define RASEO_RequireDataEncryption 0x1000
-#define RASEO_NetworkLogon 0x2000
-#define RASEO_UseLogonCredentials 0x4000
-#define RASEO_PromoteAlternates 0x8000
+#ifdef USE_WS_PREFIX
+#define WS(x) WS_##x
+#else
+#define WS(x) x
+#endif
+
+typedef struct WS(in6_addr) RASIPV6ADDR;
+typedef struct WS(in_addr) RASIPV4ADDR;
+
+#undef WS
+
+#define RASEO_UseCountryAndAreaCodes 0x00000001
+#define RASEO_SpecificIpAddr 0x00000002
+#define RASEO_SpecificNameServers 0x00000004
+#define RASEO_IpHeaderCompression 0x00000008
+#define RASEO_RemoteDefaultGateway 0x00000010
+#define RASEO_DisableLcpExtensions 0x00000020
+#define RASEO_TerminalBeforeDial 0x00000040
+#define RASEO_TerminalAfterDial 0x00000080
+#define RASEO_ModemLights 0x00000100
+#define RASEO_SwCompression 0x00000200
+#define RASEO_RequireEncryptedPw 0x00000400
+#define RASEO_RequireMsEncryptedPw 0x00000800
+#define RASEO_RequireDataEncryption 0x00001000
+#define RASEO_NetworkLogon 0x00002000
+#define RASEO_UseLogonCredentials 0x00004000
+#define RASEO_PromoteAlternates 0x00008000
+#define RASEO_SecureLocalFiles 0x00010000
+#define RASEO_RequireEAP 0x00020000
+#define RASEO_RequirePAP 0x00040000
+#define RASEO_RequireSPAP 0x00080000
+#define RASEO_Custom 0x00100000
+#define RASEO_PreviewPhoneNumber 0x00200000
+#define RASEO_SharedPhoneNumbers 0x00800000
+#define RASEO_PreviewUserPw 0x01000000
+#define RASEO_PreviewDomain 0x02000000
+#define RASEO_ShowDialingProgress 0x04000000
+#define RASEO_RequireCHAP 0x08000000
+#define RASEO_RequireMsCHAP 0x10000000
+#define RASEO_RequireMsCHAP2 0x20000000
+#define RASEO_RequireW95MSCHAP 0x40000000
+#define RASEO_CustomScript 0x80000000
+
+#define RASNP_NetBEUI 0x00000001
+#define RASNP_Ipx 0x00000002
+#define RASNP_Ip 0x00000004
+#define RASNP_Ipv6 0x00000008
+
+#define RASFP_Ppp 0x00000001
+#define RASFP_Slip 0x00000002
+#define RASFP_Ras 0x00000004
+
+#define RASEDM_DialAll 1
+#define RASEDM_DialAsNeeded 2
+
+#define RASIDS_Disabled 0xffffffff
+#define RASIDS_UseGlobalValue 0
+
+#define RASET_Phone 1
+#define RASET_Vpn 2
+#define RASET_Direct 3
+#define RASET_Internet 4
+#define RASET_Broadband 5
+
+#define ET_None 0
+#define ET_Require 1
+#define ET_RequireMax 2
+#define ET_Optional 3
+
+#define VS_Default 0
+#define VS_PptpOnly 1
+#define VS_PptpFirst 2
+#define VS_L2tpOnly 3
+#define VS_L2tpFirst 4
+#define VS_SstpOnly 5
+#define VS_SstpFirst 6
+#define VS_Ikev2Only 7
+#define VS_Ikev2First 8
+#define VS_GREOnly 9
+#define VS_PptpSstp 12
+#define VS_L2tpSstp 13
+#define VS_Ikev2Sstp 14
+
+#define RASEO2_SecureFileAndPrint 0x00000001
+#define RASEO2_SecureClientForMSNet 0x00000002
+#define RASEO2_DontNegotiateMultilink 0x00000004
+#define RASEO2_DontUseRasCredentials 0x00000008
+#define RASEO2_UsePreSharedKey 0x00000010
+#define RASEO2_Internet 0x00000020
+#define RASEO2_DisableNbtOverIP 0x00000040
+#define RASEO2_UseGlobalDeviceSettings 0x00000080
+#define RASEO2_ReconnectIfDropped 0x00000100
+#define RASEO2_SharePhoneNumbers 0x00000200
+#define RASEO2_SecureRoutingCompartment 0x00000400
+#define RASEO2_UseTypicalSettings 0x00000800
+#define RASEO2_IPv6SpecificNameServers 0x00001000
+#define RASEO2_IPv6RemoteDefaultGateway 0x00002000
+#define RASEO2_RegisterIpWithDNS 0x00004000
+#define RASEO2_UseDNSSuffixForRegistration 0x00008000
+#define RASEO2_IPv4ExplicitMetric 0x00010000
+#define RASEO2_IPv6ExplicitMetric 0x00020000
+#define RASEO2_DisableIKENameEkuCheck 0x00040000
+#define RASEO2_DisableClassBasedStaticRoute 0x00080000
+#define RASEO2_SpecificIPv6Addr 0x00100000
+#define RASEO2_DisableMobility 0x00200000
+#define RASEO2_RequireMachineCertificates 0x00400000
+#define RASEO2_UsePreSharedKeyForIkev2Initiator 0x00800000
+#define RASEO2_UsePreSharedKeyForIkev2Responder 0x01000000
+#define RASEO2_CacheCredentials 0x02000000
+#define RASEO2_AutoTriggerCapable 0x04000000
+#define RASEO2_IsThirdPartyProfile 0x08000000
+#define RASEO2_AuthTypeIsOtp 0x10000000
+#define RASEO2_IsAlwaysOn 0x20000000
+#define RASEO2_IsPrivateNetwork 0x40000000
typedef struct tagRASENTRYA {
DWORD dwSize;
DWORD dwfOptions;
@@ -238,6 +385,15 @@ typedef struct tagRASENTRYA {
CHAR szPrerequisiteEntry[RAS_MaxEntryName + 1];
DWORD dwRedialCount;
DWORD dwRedialPause;
+
+ RASIPV6ADDR ipv6addrDns;
+ RASIPV6ADDR ipv6addrDnsAlt;
+ DWORD dwIPv4InterfaceMetric;
+ DWORD dwIPv6InterfaceMetric;
+
+ RASIPV6ADDR ipv6addr;
+ DWORD dwIPv6PrefixLength;
+ DWORD dwNetworkOutageTime;
} RASENTRYA, *LPRASENTRYA;
typedef struct tagRASENTRYW {
@@ -312,45 +468,84 @@ typedef struct tagRASENTRYW {
WCHAR szPrerequisiteEntry[RAS_MaxEntryName + 1];
DWORD dwRedialCount;
DWORD dwRedialPause;
+
+ RASIPV6ADDR ipv6addrDns;
+ RASIPV6ADDR ipv6addrDnsAlt;
+ DWORD dwIPv4InterfaceMetric;
+ DWORD dwIPv6InterfaceMetric;
+
+ RASIPV6ADDR ipv6addr;
+ DWORD dwIPv6PrefixLength;
+ DWORD dwNetworkOutageTime;
} RASENTRYW, *LPRASENTRYW;
DECL_WINELIB_TYPE_AW(RASENTRY)
+#define RASTUNNELENDPOINT_UNKNOWN 0
+#define RASTUNNELENDPOINT_IPv4 1
+#define RASTUNNELENDPOINT_IPv6 2
+typedef struct tagRASTUNNELENDPOINT
+{
+ DWORD dwType;
+ union {
+ RASIPV4ADDR ipv4;
+ RASIPV6ADDR ipv6;
+ } DUMMYUNIONNAME;
+} RASTUNNELENDPOINT;
+
#define RASCS_PAUSED 0x1000
#define RASCS_DONE 0x2000
typedef enum tagRASCONNSTATE
{
- RASCS_OpenPort = 0,
- RASCS_PortOpened,
- RASCS_ConnectDevice,
- RASCS_DeviceConnected,
- RASCS_AllDevicesConnected,
- RASCS_Authenticate,
- RASCS_AuthNotify,
- RASCS_AuthRetry,
- RASCS_AuthCallback,
- RASCS_AuthChangePassword,
- RASCS_AuthProject,
- RASCS_AuthLinkSpeed,
- RASCS_AuthAck,
- RASCS_ReAuthenticate,
- RASCS_Authenticated,
- RASCS_PrepareForCallback,
- RASCS_WaitForModemReset,
- RASCS_WaitForCallback,
- RASCS_Projected,
- RASCS_StartAuthentication,
- RASCS_CallbackComplete,
- RASCS_LogonNetwork,
- RASCS_SubEntryConnected,
- RASCS_SubEntryDisconnected,
- RASCS_Interactive = RASCS_PAUSED,
- RASCS_RetryAuthentication,
- RASCS_CallbackSetByCaller,
- RASCS_PasswordExpired,
- RASCS_Connected = RASCS_DONE,
- RASCS_Disconnected
-} RASCONNSTATE, *LPRASCONNSTATE;
+ RASCS_OpenPort = 0,
+ RASCS_PortOpened,
+ RASCS_ConnectDevice,
+ RASCS_DeviceConnected,
+ RASCS_AllDevicesConnected,
+ RASCS_Authenticate,
+ RASCS_AuthNotify,
+ RASCS_AuthRetry,
+ RASCS_AuthCallback,
+ RASCS_AuthChangePassword,
+ RASCS_AuthProject,
+ RASCS_AuthLinkSpeed,
+ RASCS_AuthAck,
+ RASCS_ReAuthenticate,
+ RASCS_Authenticated,
+ RASCS_PrepareForCallback,
+ RASCS_WaitForModemReset,
+ RASCS_WaitForCallback,
+ RASCS_Projected,
+ RASCS_StartAuthentication,
+ RASCS_CallbackComplete,
+ RASCS_LogonNetwork,
+ RASCS_SubEntryConnected,
+ RASCS_SubEntryDisconnected,
+ RASCS_ApplySettings,
+ RASCS_Interactive = RASCS_PAUSED,
+ RASCS_RetryAuthentication,
+ RASCS_CallbackSetByCaller,
+ RASCS_PasswordExpired,
+ RASCS_InvokeEapUI,
+ RASCS_Connected = RASCS_DONE,
+ RASCS_Disconnected
+} RASCONNSTATE, *LPRASCONNSTATE;
+
+#define RASDIALEVENT "RasDialEvent"
+#define WM_RASDIALEVENT 0xCCCD
+
+typedef VOID (WINAPI *RASDIALFUNC)(UINT, RASCONNSTATE, DWORD);
+typedef VOID (WINAPI *RASDIALFUNC1)(HRASCONN, UINT, RASCONNSTATE, DWORD, DWORD);
+typedef DWORD (WINAPI *RASDIALFUNC2)(ULONG_PTR, DWORD, HRASCONN, UINT, RASCONNSTATE, DWORD, DWORD);
+
+#define RASCSS_DONE 0x2000
+typedef enum tagRASCONNSUBSTATE
+{
+ RASCSS_None = 0,
+ RASCSS_Dormant,
+ RASCSS_Reconnecting,
+ RASCSS_Reconnected = RASCSS_DONE,
+} RASCONNSUBSTATE, *LPRASCONNSUBSTATE;
typedef struct tagRASCONNSTATUSA
{
@@ -359,6 +554,10 @@ typedef struct tagRASCONNSTATUSA
DWORD dwError;
CHAR szDeviceType[RAS_MaxDeviceType + 1];
CHAR szDeviceName[RAS_MaxDeviceName + 1];
+ CHAR szPhoneNumber[RAS_MaxPhoneNumber + 1];
+ RASTUNNELENDPOINT localEndPoint;
+ RASTUNNELENDPOINT remoteEndPoint;
+ RASCONNSUBSTATE rasconnsubstate;
} RASCONNSTATUSA, *LPRASCONNSTATUSA;
typedef struct tagRASCONNSTATUSW
@@ -368,6 +567,10 @@ typedef struct tagRASCONNSTATUSW
DWORD dwError;
WCHAR szDeviceType[RAS_MaxDeviceType + 1];
WCHAR szDeviceName[RAS_MaxDeviceName + 1];
+ WCHAR szPhoneNumber[RAS_MaxPhoneNumber + 1];
+ RASTUNNELENDPOINT localEndPoint;
+ RASTUNNELENDPOINT remoteEndPoint;
+ RASCONNSUBSTATE rasconnsubstate;
} RASCONNSTATUSW, *LPRASCONNSTATUSW;
DECL_WINELIB_TYPE_AW(RASCONNSTATUS)
@@ -378,7 +581,9 @@ typedef enum tagRASPROJECTION
RASP_PppNbf = 0x803F,
RASP_PppIpx = 0x802B,
RASP_PppIp = 0x8021,
+ RASP_PppCcp = 0x80FD,
RASP_PppLcp = 0xC021,
+ RASP_PppIpv6 = 0x8057,
RASP_Slip = 0x20000
} RASPROJECTION, *LPRASPROJECTION;
@@ -402,12 +607,28 @@ typedef struct tagRASSUBENTRYW
DWORD dwAlternateOffset;
} RASSUBENTRYW, *LPRASSUBENTRYW;
+typedef struct tagRASEAPINFO
+{
+ DWORD dwSizeofEapInfo;
+ BYTE *pbEapInfo;
+} RASEAPINFO;
+
+typedef struct tagRASDEVSPECIFICINFO
+{
+ DWORD dwSize;
+ BYTE *pbDevSpecificInfo;
+} RASDEVSPECIFICINFO, *PRASDEVSPECIFICINFO;
+
typedef struct tagRASDIALEXTENSIONS
{
DWORD dwSize;
DWORD dwfOptions;
HWND hwndParent;
ULONG_PTR reserved;
+ ULONG_PTR reserved1;
+ RASEAPINFO RasEapInfo;
+ BOOL fSkipPppAuth;
+ RASDEVSPECIFICINFO RasDevSpecificInfo;
} RASDIALEXTENSIONS, *LPRASDIALEXTENSIONS;
typedef struct tagRASAUTODIALENTRYA
@@ -426,6 +647,32 @@ typedef struct tagRASAUTODIALENTRYW
WCHAR szEntry[ RAS_MaxEntryName + 1 ];
} RASAUTODIALENTRYW, *LPRASAUTODIALENTRYW;
+#define RASADFLG_PositionDlg 0x00000001
+typedef struct tagRASADPARAMS
+{
+ DWORD dwSize;
+ HWND hwndOwner;
+ DWORD dwFlags;
+ LONG xDlg;
+ LONG yDlg;
+} RASADPARAMS, *LPRASADPARAMS;
+
+typedef BOOL (WINAPI *RASADFUNCA)(LPSTR, LPSTR, LPRASADPARAMS, LPDWORD);
+typedef BOOL (WINAPI *RASADFUNCW)(LPWSTR, LPWSTR, LPRASADPARAMS, LPDWORD);
+
+#define RASADP_DisableConnectionQuery 0
+#define RASADP_LoginSessionDisable 1
+#define RASADP_SavedAddressesLimit 2
+#define RASADP_FailedConnectionTimeout 3
+#define RASADP_ConnectionQueryTimeout 4
+
+#define RASCN_Connection 0x00000001
+#define RASCN_Disconnection 0x00000002
+#define RASCN_BandwidthAdded 0x00000004
+#define RASCN_BandwidthRemoved 0x00000008
+#define RASCN_Dormant 0x00000010
+#define RASCN_ReConnection 0x00000020
+
typedef struct _RAS_STATS
{
DWORD dwSize;
--
2.21.0
1
0
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/kernel32/time.c | 27 +++++----------------------
1 file changed, 5 insertions(+), 22 deletions(-)
diff --git a/dlls/kernel32/time.c b/dlls/kernel32/time.c
index 23b47084db..817a830518 100644
--- a/dlls/kernel32/time.c
+++ b/dlls/kernel32/time.c
@@ -47,6 +47,7 @@
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
+#include "winreg.h"
#include "winternl.h"
#include "kernel_private.h"
#include "wine/unicode.h"
@@ -381,24 +382,6 @@ static BOOL reg_query_value(HKEY hkey, LPCWSTR name, DWORD type, void *data, DWO
return TRUE;
}
-static BOOL reg_load_mui_string(HKEY hkey, LPCWSTR value, LPWSTR buffer, DWORD size)
-{
- static const WCHAR advapi32W[] = {'a','d','v','a','p','i','3','2','.','d','l','l',0};
- DWORD (WINAPI *pRegLoadMUIStringW)(HKEY, LPCWSTR, LPWSTR, DWORD, DWORD *, DWORD, LPCWSTR);
- HMODULE hDll;
- BOOL ret = FALSE;
-
- hDll = LoadLibraryExW(advapi32W, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
- if (hDll) {
- pRegLoadMUIStringW = (void *)GetProcAddress(hDll, "RegLoadMUIStringW");
- if (pRegLoadMUIStringW &&
- !pRegLoadMUIStringW(hkey, value, buffer, size, NULL, 0, DIR_System))
- ret = TRUE;
- FreeLibrary(hDll);
- }
- return ret;
-}
-
/***********************************************************************
* TIME_GetSpecificTimeZoneInfo
*
@@ -438,14 +421,14 @@ static BOOL TIME_GetSpecificTimeZoneInfo( const WCHAR *key_name, WORD year,
if (!TIME_GetSpecificTimeZoneKey( key_name, &time_zone_key ))
return FALSE;
- if (!reg_load_mui_string( time_zone_key, mui_stdW, tzinfo->StandardName, sizeof(tzinfo->StandardName) ) &&
+ if (RegLoadMUIStringW( time_zone_key, mui_stdW, tzinfo->StandardName, sizeof(tzinfo->StandardName), NULL, 0, DIR_System ) &&
!reg_query_value( time_zone_key, stdW, REG_SZ, tzinfo->StandardName, sizeof(tzinfo->StandardName) ))
{
NtClose( time_zone_key );
return FALSE;
}
- if (!reg_load_mui_string( time_zone_key, mui_dltW, tzinfo->DaylightName, sizeof(tzinfo->DaylightName) ) &&
+ if (RegLoadMUIStringW( time_zone_key, mui_dltW, tzinfo->DaylightName, sizeof(tzinfo->DaylightName), NULL, 0, DIR_System ) &&
!reg_query_value( time_zone_key, dltW, REG_SZ, tzinfo->DaylightName, sizeof(tzinfo->DaylightName) ))
{
NtClose( time_zone_key );
@@ -1005,8 +988,8 @@ DWORD WINAPI GetDynamicTimeZoneInformation(DYNAMIC_TIME_ZONE_INFORMATION *tzinfo
if (!TIME_GetSpecificTimeZoneKey( tzinfo->TimeZoneKeyName, &time_zone_key ))
return TIME_ZONE_ID_INVALID;
- reg_load_mui_string( time_zone_key, mui_stdW, tzinfo->StandardName, sizeof(tzinfo->StandardName) );
- reg_load_mui_string( time_zone_key, mui_dltW, tzinfo->DaylightName, sizeof(tzinfo->DaylightName) );
+ RegLoadMUIStringW( time_zone_key, mui_stdW, tzinfo->StandardName, sizeof(tzinfo->StandardName), NULL, 0, DIR_System );
+ RegLoadMUIStringW( time_zone_key, mui_dltW, tzinfo->DaylightName, sizeof(tzinfo->DaylightName), NULL, 0, DIR_System );
NtClose( time_zone_key );
return TIME_ZoneID( (TIME_ZONE_INFORMATION*)tzinfo );
--
2.24.0
3
3
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/quartz/tests/vmr9.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c
index 8db5171358..160a8f8804 100644
--- a/dlls/quartz/tests/vmr9.c
+++ b/dlls/quartz/tests/vmr9.c
@@ -1440,6 +1440,7 @@ static void test_connect_pin(void)
IFilterGraph2_AddFilter(graph, filter, NULL);
IBaseFilter_FindPin(filter, L"VMR Input0", &pin);
+ IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&input);
for (i = 0; i < ARRAY_SIZE(subtype_tests); ++i)
{
@@ -1511,8 +1512,6 @@ static void test_connect_pin(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
- IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&input);
-
test_allocator(input);
hr = IMemInputPin_GetAllocator(input, &allocator);
--
2.24.0
1
0
22 Nov '19
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
---
dlls/msvcrt/string.c | 263 ++++++++++++++++++++++++++++++-----
dlls/ucrtbase/tests/string.c | 15 +-
2 files changed, 239 insertions(+), 39 deletions(-)
1
0
[PATCH 1/2] msvcrt: Use isspace_l in string to number conversion functions.
by Piotr Caban 22 Nov '19
by Piotr Caban 22 Nov '19
22 Nov '19
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
---
dlls/msvcrt/msvcrt.h | 1 +
dlls/msvcrt/string.c | 9 ++++-----
2 files changed, 5 insertions(+), 5 deletions(-)
1
0
22 Nov '19
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/wininet/Makefile.in | 4 +-
dlls/wininet/internet.c | 201 +++++++++++++++++++++++++++++++++------
2 files changed, 173 insertions(+), 32 deletions(-)
diff --git a/dlls/wininet/Makefile.in b/dlls/wininet/Makefile.in
index 6eeb7cf85b..e1d4979d87 100644
--- a/dlls/wininet/Makefile.in
+++ b/dlls/wininet/Makefile.in
@@ -2,9 +2,9 @@ EXTRADEFS = -D_WINX32_
MODULE = wininet.dll
IMPORTLIB = wininet
IMPORTS = mpr shlwapi shell32 user32 ws2_32 advapi32
-DELAYIMPORTS = secur32 crypt32 cryptui
+DELAYIMPORTS = secur32 crypt32 cryptui dhcpcsvc iphlpapi
EXTRAINCL = $(Z_CFLAGS)
-EXTRALIBS = $(CORESERVICES_LIBS) $(Z_LIBS)
+EXTRALIBS = $(Z_LIBS)
C_SRCS = \
cookie.c \
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 266100861d..3e8be9fa2b 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -28,14 +28,6 @@
#include "config.h"
-#ifdef HAVE_CORESERVICES_CORESERVICES_H
-#define GetCurrentThread MacGetCurrentThread
-#define LoadResource MacLoadResource
-#include <CoreServices/CoreServices.h>
-#undef GetCurrentThread
-#undef LoadResource
-#endif
-
#include "winsock2.h"
#include "ws2ipdef.h"
@@ -56,6 +48,10 @@
#include "winerror.h"
#define NO_SHLWAPI_STREAM
#include "shlwapi.h"
+#include "ws2tcpip.h"
+#include "winternl.h"
+#include "iphlpapi.h"
+#include "dhcpcsdk.h"
#include "wine/exception.h"
@@ -2295,38 +2291,183 @@ BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer,
return res == ERROR_SUCCESS;
}
-static WCHAR *get_proxy_autoconfig_url(void)
+static IP_ADAPTER_ADDRESSES *get_adapters(void)
{
-#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+ ULONG err, size = 1024, flags = GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST |
+ GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_SKIP_FRIENDLY_NAME;
+ IP_ADAPTER_ADDRESSES *tmp, *ret;
- CFDictionaryRef settings = CFNetworkCopySystemProxySettings();
- WCHAR *ret = NULL;
- SIZE_T len;
- const void *ref;
+ if (!(ret = heap_alloc( size ))) return NULL;
+ err = GetAdaptersAddresses( AF_UNSPEC, flags, NULL, ret, &size );
+ while (err == ERROR_BUFFER_OVERFLOW)
+ {
+ if (!(tmp = heap_realloc( ret, size ))) break;
+ ret = tmp;
+ err = GetAdaptersAddresses( AF_UNSPEC, flags, NULL, ret, &size );
+ }
+ if (err == ERROR_SUCCESS) return ret;
+ heap_free( ret );
+ return NULL;
+}
+
+static WCHAR *detect_proxy_autoconfig_url_dhcp(void)
+{
+ IP_ADAPTER_ADDRESSES *adapters, *ptr;
+ DHCPCAPI_PARAMS_ARRAY send_params, recv_params;
+ DHCPCAPI_PARAMS param;
+ WCHAR name[MAX_ADAPTER_NAME_LENGTH + 1], *ret = NULL;
+ DWORD err, size;
+ BYTE *tmp, *buf = NULL;
+
+ if (!(adapters = get_adapters())) return NULL;
+
+ memset( &send_params, 0, sizeof(send_params) );
+ memset( ¶m, 0, sizeof(param) );
+ param.OptionId = OPTION_MSFT_IE_PROXY;
+ recv_params.nParams = 1;
+ recv_params.Params = ¶m;
+
+ for (ptr = adapters; ptr; ptr = ptr->Next)
+ {
+ MultiByteToWideChar( CP_ACP, 0, ptr->AdapterName, -1, name, ARRAY_SIZE(name) );
+ TRACE( "adapter '%s' type %u dhcpv4 enabled %d\n", wine_dbgstr_w(name), ptr->IfType, ptr->Dhcpv4Enabled );
+
+ if (ptr->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue;
+ /* FIXME: also skip adapters where DHCP is disabled */
+
+ size = 256;
+ if (!(buf = heap_alloc( size ))) goto done;
+ err = DhcpRequestParams( DHCPCAPI_REQUEST_SYNCHRONOUS, NULL, name, NULL, send_params, recv_params,
+ buf, &size, NULL );
+ while (err == ERROR_MORE_DATA)
+ {
+ if (!(tmp = heap_realloc( buf, size ))) goto done;
+ buf = tmp;
+ err = DhcpRequestParams( DHCPCAPI_REQUEST_SYNCHRONOUS, NULL, name, NULL, send_params, recv_params,
+ buf, &size, NULL );
+ }
+ if (err == ERROR_SUCCESS && param.nBytesData)
+ {
+ int len = MultiByteToWideChar( CP_ACP, 0, (const char *)param.Data, param.nBytesData, NULL, 0 );
+ if ((ret = heap_alloc( (len + 1) * sizeof(WCHAR) )))
+ {
+ MultiByteToWideChar( CP_ACP, 0, (const char *)param.Data, param.nBytesData, ret, len );
+ ret[len] = 0;
+ }
+ TRACE("returning %s\n", debugstr_w(ret));
+ break;
+ }
+ }
- if (!settings) return NULL;
+done:
+ heap_free( buf );
+ heap_free( adapters );
+ return ret;
+}
- if (!(ref = CFDictionaryGetValue( settings, kCFNetworkProxiesProxyAutoConfigURLString )))
+static char *get_computer_name( COMPUTER_NAME_FORMAT format )
+{
+ char *ret;
+ DWORD size = 0;
+
+ GetComputerNameExA( format, NULL, &size );
+ if (GetLastError() != ERROR_MORE_DATA) return NULL;
+ if (!(ret = heap_alloc( size ))) return NULL;
+ if (!GetComputerNameExA( format, ret, &size ))
{
- CFRelease( settings );
+ heap_free( ret );
return NULL;
}
- len = CFStringGetLength( ref );
- if (len)
- ret = heap_alloc( (len+1) * sizeof(WCHAR) );
- if (ret)
+ return ret;
+}
+
+static BOOL is_domain_suffix( const char *domain, const char *suffix )
+{
+ int len_domain = strlen( domain ), len_suffix = strlen( suffix );
+
+ if (len_suffix > len_domain) return FALSE;
+ if (!_strnicmp( domain + len_domain - len_suffix, suffix, -1 )) return TRUE;
+ return FALSE;
+}
+
+static int reverse_lookup( const struct addrinfo *ai, char *hostname, size_t len )
+{
+ return getnameinfo( ai->ai_addr, ai->ai_addrlen, hostname, len, NULL, 0, 0 );
+}
+
+static WCHAR *build_wpad_url( const char *hostname, const struct addrinfo *ai )
+{
+ static const WCHAR httpW[] = {'h','t','t','p',':','/','/',0};
+ static const WCHAR wpadW[] = {'/','w','p','a','d','.','d','a','t',0};
+ char name[NI_MAXHOST];
+ WCHAR *ret, *p;
+ int len;
+
+ while (ai && ai->ai_family != AF_INET && ai->ai_family != AF_INET6) ai = ai->ai_next;
+ if (!ai) return NULL;
+
+ if (!reverse_lookup( ai, name, sizeof(name) )) hostname = name;
+
+ len = lstrlenW( httpW ) + strlen( hostname ) + lstrlenW( wpadW );
+ if (!(ret = p = GlobalAlloc( 0, (len + 1) * sizeof(WCHAR) ))) return NULL;
+ lstrcpyW( p, httpW );
+ p += lstrlenW( httpW );
+ while (*hostname) { *p++ = *hostname++; }
+ lstrcpyW( p, wpadW );
+ return ret;
+}
+
+static WCHAR *detect_proxy_autoconfig_url_dns(void)
+{
+ char *fqdn, *domain, *p;
+ WCHAR *ret;
+
+ if (!(fqdn = get_computer_name( ComputerNamePhysicalDnsFullyQualified ))) return NULL;
+ if (!(domain = get_computer_name( ComputerNamePhysicalDnsDomain )))
+ {
+ heap_free( fqdn );
+ return NULL;
+ }
+ p = fqdn;
+ while ((p = strchr( p, '.' )) && is_domain_suffix( p + 1, domain ))
{
- CFStringGetCharacters( ref, CFRangeMake(0, len), ret );
- ret[len] = 0;
+ char *name;
+ struct addrinfo *ai;
+ int res;
+
+ if (!(name = heap_alloc( sizeof("wpad") + strlen(p) )))
+ {
+ heap_free( fqdn );
+ heap_free( domain );
+ return NULL;
+ }
+ strcpy( name, "wpad" );
+ strcat( name, p );
+ res = getaddrinfo( name, NULL, NULL, &ai );
+ if (!res)
+ {
+ ret = build_wpad_url( name, ai );
+ freeaddrinfo( ai );
+ if (ret)
+ {
+ TRACE("returning %s\n", debugstr_w(ret));
+ heap_free( name );
+ break;
+ }
+ }
+ heap_free( name );
+ p++;
}
- TRACE( "returning %s\n", debugstr_w(ret) );
- CFRelease( settings );
+ heap_free( domain );
+ heap_free( fqdn );
+ return ret;
+}
+
+static WCHAR *get_proxy_autoconfig_url(void)
+{
+ WCHAR *ret = detect_proxy_autoconfig_url_dhcp();
+ if (!ret) ret = detect_proxy_autoconfig_url_dns();
return ret;
-#else
- static int once;
- if (!once++) FIXME( "no support on this platform\n" );
- return NULL;
-#endif
}
static DWORD query_global_option(DWORD option, void *buffer, DWORD *size, BOOL unicode)
--
2.20.1
1
0
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/winhttp/cookie.c | 6 +-
dlls/winhttp/request.c | 333 ++++++++++++---------------------
dlls/winhttp/session.c | 67 +++----
dlls/winhttp/url.c | 26 +--
dlls/winhttp/winhttp_private.h | 8 -
5 files changed, 155 insertions(+), 285 deletions(-)
diff --git a/dlls/winhttp/cookie.c b/dlls/winhttp/cookie.c
index 3166290eab..83efc7f85c 100644
--- a/dlls/winhttp/cookie.c
+++ b/dlls/winhttp/cookie.c
@@ -262,8 +262,6 @@ static struct attr *parse_attr( const WCHAR *str, int *used )
BOOL set_cookies( struct request *request, const WCHAR *cookies )
{
- static const WCHAR pathW[] = {'p','a','t','h',0};
- static const WCHAR domainW[] = {'d','o','m','a','i','n',0};
BOOL ret = FALSE;
WCHAR *buffer, *p;
WCHAR *cookie_domain = NULL, *cookie_path = NULL;
@@ -287,12 +285,12 @@ BOOL set_cookies( struct request *request, const WCHAR *cookies )
len = lstrlenW( p );
while (len && (attr = parse_attr( p, &used )))
{
- if (!wcsicmp( attr->name, domainW ))
+ if (!wcsicmp( attr->name, L"domain" ))
{
domain = attr;
cookie_domain = attr->value;
}
- else if (!wcsicmp( attr->name, pathW ))
+ else if (!wcsicmp( attr->name, L"path" ))
{
path = attr;
cookie_path = attr->value;
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 0fd1d1abe9..7c8e6ba89e 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -41,136 +41,79 @@ WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
#define DEFAULT_KEEP_ALIVE_TIMEOUT 30000
-static const WCHAR attr_accept[] = {'A','c','c','e','p','t',0};
-static const WCHAR attr_accept_charset[] = {'A','c','c','e','p','t','-','C','h','a','r','s','e','t', 0};
-static const WCHAR attr_accept_encoding[] = {'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g',0};
-static const WCHAR attr_accept_language[] = {'A','c','c','e','p','t','-','L','a','n','g','u','a','g','e',0};
-static const WCHAR attr_accept_ranges[] = {'A','c','c','e','p','t','-','R','a','n','g','e','s',0};
-static const WCHAR attr_age[] = {'A','g','e',0};
-static const WCHAR attr_allow[] = {'A','l','l','o','w',0};
-static const WCHAR attr_authorization[] = {'A','u','t','h','o','r','i','z','a','t','i','o','n',0};
-static const WCHAR attr_cache_control[] = {'C','a','c','h','e','-','C','o','n','t','r','o','l',0};
-static const WCHAR attr_connection[] = {'C','o','n','n','e','c','t','i','o','n',0};
-static const WCHAR attr_content_base[] = {'C','o','n','t','e','n','t','-','B','a','s','e',0};
-static const WCHAR attr_content_encoding[] = {'C','o','n','t','e','n','t','-','E','n','c','o','d','i','n','g',0};
-static const WCHAR attr_content_id[] = {'C','o','n','t','e','n','t','-','I','D',0};
-static const WCHAR attr_content_language[] = {'C','o','n','t','e','n','t','-','L','a','n','g','u','a','g','e',0};
-static const WCHAR attr_content_length[] = {'C','o','n','t','e','n','t','-','L','e','n','g','t','h',0};
-static const WCHAR attr_content_location[] = {'C','o','n','t','e','n','t','-','L','o','c','a','t','i','o','n',0};
-static const WCHAR attr_content_md5[] = {'C','o','n','t','e','n','t','-','M','D','5',0};
-static const WCHAR attr_content_range[] = {'C','o','n','t','e','n','t','-','R','a','n','g','e',0};
-static const WCHAR attr_content_transfer_encoding[] = {'C','o','n','t','e','n','t','-','T','r','a','n','s','f','e','r','-','E','n','c','o','d','i','n','g',0};
-static const WCHAR attr_content_type[] = {'C','o','n','t','e','n','t','-','T','y','p','e',0};
-static const WCHAR attr_cookie[] = {'C','o','o','k','i','e',0};
-static const WCHAR attr_date[] = {'D','a','t','e',0};
-static const WCHAR attr_from[] = {'F','r','o','m',0};
-static const WCHAR attr_etag[] = {'E','T','a','g',0};
-static const WCHAR attr_expect[] = {'E','x','p','e','c','t',0};
-static const WCHAR attr_expires[] = {'E','x','p','i','r','e','s',0};
-static const WCHAR attr_host[] = {'H','o','s','t',0};
-static const WCHAR attr_if_match[] = {'I','f','-','M','a','t','c','h',0};
-static const WCHAR attr_if_modified_since[] = {'I','f','-','M','o','d','i','f','i','e','d','-','S','i','n','c','e',0};
-static const WCHAR attr_if_none_match[] = {'I','f','-','N','o','n','e','-','M','a','t','c','h',0};
-static const WCHAR attr_if_range[] = {'I','f','-','R','a','n','g','e',0};
-static const WCHAR attr_if_unmodified_since[] = {'I','f','-','U','n','m','o','d','i','f','i','e','d','-','S','i','n','c','e',0};
-static const WCHAR attr_last_modified[] = {'L','a','s','t','-','M','o','d','i','f','i','e','d',0};
-static const WCHAR attr_location[] = {'L','o','c','a','t','i','o','n',0};
-static const WCHAR attr_max_forwards[] = {'M','a','x','-','F','o','r','w','a','r','d','s',0};
-static const WCHAR attr_mime_version[] = {'M','i','m','e','-','V','e','r','s','i','o','n',0};
-static const WCHAR attr_pragma[] = {'P','r','a','g','m','a',0};
-static const WCHAR attr_proxy_authenticate[] = {'P','r','o','x','y','-','A','u','t','h','e','n','t','i','c','a','t','e',0};
-static const WCHAR attr_proxy_authorization[] = {'P','r','o','x','y','-','A','u','t','h','o','r','i','z','a','t','i','o','n',0};
-static const WCHAR attr_proxy_connection[] = {'P','r','o','x','y','-','C','o','n','n','e','c','t','i','o','n',0};
-static const WCHAR attr_public[] = {'P','u','b','l','i','c',0};
-static const WCHAR attr_range[] = {'R','a','n','g','e',0};
-static const WCHAR attr_referer[] = {'R','e','f','e','r','e','r',0};
-static const WCHAR attr_retry_after[] = {'R','e','t','r','y','-','A','f','t','e','r',0};
-static const WCHAR attr_server[] = {'S','e','r','v','e','r',0};
-static const WCHAR attr_set_cookie[] = {'S','e','t','-','C','o','o','k','i','e',0};
-static const WCHAR attr_status[] = {'S','t','a','t','u','s',0};
-static const WCHAR attr_transfer_encoding[] = {'T','r','a','n','s','f','e','r','-','E','n','c','o','d','i','n','g',0};
-static const WCHAR attr_unless_modified_since[] = {'U','n','l','e','s','s','-','M','o','d','i','f','i','e','d','-','S','i','n','c','e',0};
-static const WCHAR attr_upgrade[] = {'U','p','g','r','a','d','e',0};
-static const WCHAR attr_uri[] = {'U','R','I',0};
-static const WCHAR attr_user_agent[] = {'U','s','e','r','-','A','g','e','n','t',0};
-static const WCHAR attr_vary[] = {'V','a','r','y',0};
-static const WCHAR attr_via[] = {'V','i','a',0};
-static const WCHAR attr_warning[] = {'W','a','r','n','i','n','g',0};
-static const WCHAR attr_www_authenticate[] = {'W','W','W','-','A','u','t','h','e','n','t','i','c','a','t','e',0};
-
static const WCHAR *attribute_table[] =
{
- attr_mime_version, /* WINHTTP_QUERY_MIME_VERSION = 0 */
- attr_content_type, /* WINHTTP_QUERY_CONTENT_TYPE = 1 */
- attr_content_transfer_encoding, /* WINHTTP_QUERY_CONTENT_TRANSFER_ENCODING = 2 */
- attr_content_id, /* WINHTTP_QUERY_CONTENT_ID = 3 */
+ L"Mime-Version", /* WINHTTP_QUERY_MIME_VERSION = 0 */
+ L"Content-Type" , /* WINHTTP_QUERY_CONTENT_TYPE = 1 */
+ L"Content-Transfer-Encoding", /* WINHTTP_QUERY_CONTENT_TRANSFER_ENCODING = 2 */
+ L"Content-ID", /* WINHTTP_QUERY_CONTENT_ID = 3 */
NULL, /* WINHTTP_QUERY_CONTENT_DESCRIPTION = 4 */
- attr_content_length, /* WINHTTP_QUERY_CONTENT_LENGTH = 5 */
- attr_content_language, /* WINHTTP_QUERY_CONTENT_LANGUAGE = 6 */
- attr_allow, /* WINHTTP_QUERY_ALLOW = 7 */
- attr_public, /* WINHTTP_QUERY_PUBLIC = 8 */
- attr_date, /* WINHTTP_QUERY_DATE = 9 */
- attr_expires, /* WINHTTP_QUERY_EXPIRES = 10 */
- attr_last_modified, /* WINHTTP_QUERY_LAST_MODIFIEDcw = 11 */
+ L"Content-Length", /* WINHTTP_QUERY_CONTENT_LENGTH = 5 */
+ L"Content-Language", /* WINHTTP_QUERY_CONTENT_LANGUAGE = 6 */
+ L"Allow", /* WINHTTP_QUERY_ALLOW = 7 */
+ L"Public", /* WINHTTP_QUERY_PUBLIC = 8 */
+ L"Date", /* WINHTTP_QUERY_DATE = 9 */
+ L"Expires", /* WINHTTP_QUERY_EXPIRES = 10 */
+ L"Last-Modified", /* WINHTTP_QUERY_LAST_MODIFIEDcw = 11 */
NULL, /* WINHTTP_QUERY_MESSAGE_ID = 12 */
- attr_uri, /* WINHTTP_QUERY_URI = 13 */
- attr_from, /* WINHTTP_QUERY_DERIVED_FROM = 14 */
+ L"URI", /* WINHTTP_QUERY_URI = 13 */
+ L"From", /* WINHTTP_QUERY_DERIVED_FROM = 14 */
NULL, /* WINHTTP_QUERY_COST = 15 */
NULL, /* WINHTTP_QUERY_LINK = 16 */
- attr_pragma, /* WINHTTP_QUERY_PRAGMA = 17 */
+ L"Pragma", /* WINHTTP_QUERY_PRAGMA = 17 */
NULL, /* WINHTTP_QUERY_VERSION = 18 */
- attr_status, /* WINHTTP_QUERY_STATUS_CODE = 19 */
+ L"Status", /* WINHTTP_QUERY_STATUS_CODE = 19 */
NULL, /* WINHTTP_QUERY_STATUS_TEXT = 20 */
NULL, /* WINHTTP_QUERY_RAW_HEADERS = 21 */
NULL, /* WINHTTP_QUERY_RAW_HEADERS_CRLF = 22 */
- attr_connection, /* WINHTTP_QUERY_CONNECTION = 23 */
- attr_accept, /* WINHTTP_QUERY_ACCEPT = 24 */
- attr_accept_charset, /* WINHTTP_QUERY_ACCEPT_CHARSET = 25 */
- attr_accept_encoding, /* WINHTTP_QUERY_ACCEPT_ENCODING = 26 */
- attr_accept_language, /* WINHTTP_QUERY_ACCEPT_LANGUAGE = 27 */
- attr_authorization, /* WINHTTP_QUERY_AUTHORIZATION = 28 */
- attr_content_encoding, /* WINHTTP_QUERY_CONTENT_ENCODING = 29 */
+ L"Connection", /* WINHTTP_QUERY_CONNECTION = 23 */
+ L"Accept", /* WINHTTP_QUERY_ACCEPT = 24 */
+ L"Accept-Charset", /* WINHTTP_QUERY_ACCEPT_CHARSET = 25 */
+ L"Accept-Encoding", /* WINHTTP_QUERY_ACCEPT_ENCODING = 26 */
+ L"Accept-Language", /* WINHTTP_QUERY_ACCEPT_LANGUAGE = 27 */
+ L"Authorization", /* WINHTTP_QUERY_AUTHORIZATION = 28 */
+ L"Content-Encoding", /* WINHTTP_QUERY_CONTENT_ENCODING = 29 */
NULL, /* WINHTTP_QUERY_FORWARDED = 30 */
NULL, /* WINHTTP_QUERY_FROM = 31 */
- attr_if_modified_since, /* WINHTTP_QUERY_IF_MODIFIED_SINCE = 32 */
- attr_location, /* WINHTTP_QUERY_LOCATION = 33 */
+ L"If-Modified-Since", /* WINHTTP_QUERY_IF_MODIFIED_SINCE = 32 */
+ L"Location", /* WINHTTP_QUERY_LOCATION = 33 */
NULL, /* WINHTTP_QUERY_ORIG_URI = 34 */
- attr_referer, /* WINHTTP_QUERY_REFERER = 35 */
- attr_retry_after, /* WINHTTP_QUERY_RETRY_AFTER = 36 */
- attr_server, /* WINHTTP_QUERY_SERVER = 37 */
+ L"Referer", /* WINHTTP_QUERY_REFERER = 35 */
+ L"Retry-After", /* WINHTTP_QUERY_RETRY_AFTER = 36 */
+ L"Server", /* WINHTTP_QUERY_SERVER = 37 */
NULL, /* WINHTTP_TITLE = 38 */
- attr_user_agent, /* WINHTTP_QUERY_USER_AGENT = 39 */
- attr_www_authenticate, /* WINHTTP_QUERY_WWW_AUTHENTICATE = 40 */
- attr_proxy_authenticate, /* WINHTTP_QUERY_PROXY_AUTHENTICATE = 41 */
- attr_accept_ranges, /* WINHTTP_QUERY_ACCEPT_RANGES = 42 */
- attr_set_cookie, /* WINHTTP_QUERY_SET_COOKIE = 43 */
- attr_cookie, /* WINHTTP_QUERY_COOKIE = 44 */
+ L"User-Agent", /* WINHTTP_QUERY_USER_AGENT = 39 */
+ L"WWW-Authenticate", /* WINHTTP_QUERY_WWW_AUTHENTICATE = 40 */
+ L"Proxy-Authenticate", /* WINHTTP_QUERY_PROXY_AUTHENTICATE = 41 */
+ L"Accept-Ranges", /* WINHTTP_QUERY_ACCEPT_RANGES = 42 */
+ L"Set-Cookie", /* WINHTTP_QUERY_SET_COOKIE = 43 */
+ L"Cookie", /* WINHTTP_QUERY_COOKIE = 44 */
NULL, /* WINHTTP_QUERY_REQUEST_METHOD = 45 */
NULL, /* WINHTTP_QUERY_REFRESH = 46 */
NULL, /* WINHTTP_QUERY_CONTENT_DISPOSITION = 47 */
- attr_age, /* WINHTTP_QUERY_AGE = 48 */
- attr_cache_control, /* WINHTTP_QUERY_CACHE_CONTROL = 49 */
- attr_content_base, /* WINHTTP_QUERY_CONTENT_BASE = 50 */
- attr_content_location, /* WINHTTP_QUERY_CONTENT_LOCATION = 51 */
- attr_content_md5, /* WINHTTP_QUERY_CONTENT_MD5 = 52 */
- attr_content_range, /* WINHTTP_QUERY_CONTENT_RANGE = 53 */
- attr_etag, /* WINHTTP_QUERY_ETAG = 54 */
- attr_host, /* WINHTTP_QUERY_HOST = 55 */
- attr_if_match, /* WINHTTP_QUERY_IF_MATCH = 56 */
- attr_if_none_match, /* WINHTTP_QUERY_IF_NONE_MATCH = 57 */
- attr_if_range, /* WINHTTP_QUERY_IF_RANGE = 58 */
- attr_if_unmodified_since, /* WINHTTP_QUERY_IF_UNMODIFIED_SINCE = 59 */
- attr_max_forwards, /* WINHTTP_QUERY_MAX_FORWARDS = 60 */
- attr_proxy_authorization, /* WINHTTP_QUERY_PROXY_AUTHORIZATION = 61 */
- attr_range, /* WINHTTP_QUERY_RANGE = 62 */
- attr_transfer_encoding, /* WINHTTP_QUERY_TRANSFER_ENCODING = 63 */
- attr_upgrade, /* WINHTTP_QUERY_UPGRADE = 64 */
- attr_vary, /* WINHTTP_QUERY_VARY = 65 */
- attr_via, /* WINHTTP_QUERY_VIA = 66 */
- attr_warning, /* WINHTTP_QUERY_WARNING = 67 */
- attr_expect, /* WINHTTP_QUERY_EXPECT = 68 */
- attr_proxy_connection, /* WINHTTP_QUERY_PROXY_CONNECTION = 69 */
- attr_unless_modified_since, /* WINHTTP_QUERY_UNLESS_MODIFIED_SINCE = 70 */
+ L"Age", /* WINHTTP_QUERY_AGE = 48 */
+ L"Cache-Control", /* WINHTTP_QUERY_CACHE_CONTROL = 49 */
+ L"Content-Base", /* WINHTTP_QUERY_CONTENT_BASE = 50 */
+ L"Content-Location", /* WINHTTP_QUERY_CONTENT_LOCATION = 51 */
+ L"Content-MD5", /* WINHTTP_QUERY_CONTENT_MD5 = 52 */
+ L"Content-Range", /* WINHTTP_QUERY_CONTENT_RANGE = 53 */
+ L"ETag", /* WINHTTP_QUERY_ETAG = 54 */
+ L"Host", /* WINHTTP_QUERY_HOST = 55 */
+ L"If-Match", /* WINHTTP_QUERY_IF_MATCH = 56 */
+ L"If-None-Match", /* WINHTTP_QUERY_IF_NONE_MATCH = 57 */
+ L"If-Range", /* WINHTTP_QUERY_IF_RANGE = 58 */
+ L"If-Unmodified-Since", /* WINHTTP_QUERY_IF_UNMODIFIED_SINCE = 59 */
+ L"Max-Forwards", /* WINHTTP_QUERY_MAX_FORWARDS = 60 */
+ L"Proxy-Authorization", /* WINHTTP_QUERY_PROXY_AUTHORIZATION = 61 */
+ L"Range", /* WINHTTP_QUERY_RANGE = 62 */
+ L"Transfer-Encoding", /* WINHTTP_QUERY_TRANSFER_ENCODING = 63 */
+ L"Upgrade", /* WINHTTP_QUERY_UPGRADE = 64 */
+ L"Vary", /* WINHTTP_QUERY_VARY = 65 */
+ L"Via", /* WINHTTP_QUERY_VIA = 66 */
+ L"Warning", /* WINHTTP_QUERY_WARNING = 67 */
+ L"Expect", /* WINHTTP_QUERY_EXPECT = 68 */
+ L"Proxy-Connection", /* WINHTTP_QUERY_PROXY_CONNECTION = 69 */
+ L"Unless-Modified-Since", /* WINHTTP_QUERY_UNLESS_MODIFIED_SINCE = 70 */
NULL, /* WINHTTP_QUERY_PROXY_SUPPORT = 75 */
NULL, /* WINHTTP_QUERY_AUTHENTICATION_INFO = 76 */
NULL, /* WINHTTP_QUERY_PASSPORT_URLS = 77 */
@@ -543,14 +486,11 @@ BOOL WINAPI WinHttpAddRequestHeaders( HINTERNET hrequest, LPCWSTR headers, DWORD
static WCHAR *build_absolute_request_path( struct request *request, const WCHAR **path )
{
- static const WCHAR http[] = {'h','t','t','p',0};
- static const WCHAR https[] = {'h','t','t','p','s',0};
- static const WCHAR fmt[] = {'%','s',':','/','/','%','s',0};
const WCHAR *scheme;
WCHAR *ret;
int len, offset;
- scheme = (request->netconn ? request->netconn->secure : (request->hdr.flags & WINHTTP_FLAG_SECURE)) ? https : http;
+ scheme = (request->netconn ? request->netconn->secure : (request->hdr.flags & WINHTTP_FLAG_SECURE)) ? L"https" : L"http";
len = lstrlenW( scheme ) + lstrlenW( request->connect->hostname ) + 4; /* '://' + nul */
if (request->connect->hostport) len += 6; /* ':' between host and port, up to 5 for port */
@@ -558,11 +498,10 @@ static WCHAR *build_absolute_request_path( struct request *request, const WCHAR
len += lstrlenW( request->path );
if ((ret = heap_alloc( len * sizeof(WCHAR) )))
{
- offset = swprintf( ret, len, fmt, scheme, request->connect->hostname );
+ offset = swprintf( ret, len, L"%s://%s", scheme, request->connect->hostname );
if (request->connect->hostport)
{
- static const WCHAR port_fmt[] = {':','%','u',0};
- offset += swprintf( ret + offset, len - offset, port_fmt, request->connect->hostport );
+ offset += swprintf( ret + offset, len - offset, L":%u", request->connect->hostport );
}
lstrcpyW( ret + offset, request->path );
if (path) *path = ret + offset;
@@ -573,8 +512,6 @@ static WCHAR *build_absolute_request_path( struct request *request, const WCHAR
static WCHAR *build_request_string( struct request *request )
{
- static const WCHAR spaceW[] = {' ',0}, crlfW[] = {'\r','\n',0}, colonW[] = {':',' ',0};
- static const WCHAR twocrlfW[] = {'\r','\n','\r','\n',0};
WCHAR *path, *ret;
unsigned int i, len;
@@ -595,22 +532,22 @@ static WCHAR *build_request_string( struct request *request )
if ((ret = heap_alloc( (len + 1) * sizeof(WCHAR) )))
{
lstrcpyW( ret, request->verb );
- lstrcatW( ret, spaceW );
+ lstrcatW( ret, L" " );
lstrcatW( ret, path );
- lstrcatW( ret, spaceW );
+ lstrcatW( ret, L" " );
lstrcatW( ret, request->version );
for (i = 0; i < request->num_headers; i++)
{
if (request->headers[i].is_request)
{
- lstrcatW( ret, crlfW );
+ lstrcatW( ret, L"\r\n" );
lstrcatW( ret, request->headers[i].field );
- lstrcatW( ret, colonW );
+ lstrcatW( ret, L": " );
lstrcatW( ret, request->headers[i].value );
}
}
- lstrcatW( ret, twocrlfW );
+ lstrcatW( ret, L"\r\n\r\n" );
}
if (path != request->path) heap_free( path );
@@ -850,12 +787,6 @@ BOOL WINAPI WinHttpQueryHeaders( HINTERNET hrequest, DWORD level, LPCWSTR name,
return ret;
}
-static const WCHAR basicW[] = {'B','a','s','i','c',0};
-static const WCHAR ntlmW[] = {'N','T','L','M',0};
-static const WCHAR passportW[] = {'P','a','s','s','p','o','r','t',0};
-static const WCHAR digestW[] = {'D','i','g','e','s','t',0};
-static const WCHAR negotiateW[] = {'N','e','g','o','t','i','a','t','e',0};
-
static const struct
{
const WCHAR *str;
@@ -864,11 +795,11 @@ static const struct
}
auth_schemes[] =
{
- { basicW, ARRAY_SIZE(basicW) - 1, WINHTTP_AUTH_SCHEME_BASIC },
- { ntlmW, ARRAY_SIZE(ntlmW) - 1, WINHTTP_AUTH_SCHEME_NTLM },
- { passportW, ARRAY_SIZE(passportW) - 1, WINHTTP_AUTH_SCHEME_PASSPORT },
- { digestW, ARRAY_SIZE(digestW) - 1, WINHTTP_AUTH_SCHEME_DIGEST },
- { negotiateW, ARRAY_SIZE(negotiateW) - 1, WINHTTP_AUTH_SCHEME_NEGOTIATE }
+ { L"Basic", ARRAY_SIZE(L"Basic") - 1, WINHTTP_AUTH_SCHEME_BASIC },
+ { L"NTLM", ARRAY_SIZE(L"NTLM") - 1, WINHTTP_AUTH_SCHEME_NTLM },
+ { L"Passport", ARRAY_SIZE(L"Passport") - 1, WINHTTP_AUTH_SCHEME_PASSPORT },
+ { L"Digest", ARRAY_SIZE(L"Digest") - 1, WINHTTP_AUTH_SCHEME_DIGEST },
+ { L"Negotiate", ARRAY_SIZE(L"Negotiate") - 1, WINHTTP_AUTH_SCHEME_NEGOTIATE }
};
static enum auth_scheme scheme_from_flag( DWORD flag )
@@ -1147,7 +1078,7 @@ static BOOL do_authorization( struct request *request, DWORD target, DWORD schem
case WINHTTP_AUTH_TARGET_SERVER:
has_auth_value = get_authvalue( request, WINHTTP_QUERY_WWW_AUTHENTICATE, scheme_flag, auth_value, len );
auth_ptr = &request->authinfo;
- auth_target = attr_authorization;
+ auth_target = L"Authorization";
if (request->creds[TARGET_SERVER][scheme].username)
{
if (scheme != SCHEME_BASIC && !has_auth_value) return FALSE;
@@ -1166,7 +1097,7 @@ static BOOL do_authorization( struct request *request, DWORD target, DWORD schem
if (!get_authvalue( request, WINHTTP_QUERY_PROXY_AUTHENTICATE, scheme_flag, auth_value, len ))
return FALSE;
auth_ptr = &request->proxy_authinfo;
- auth_target = attr_proxy_authorization;
+ auth_target = L"Proxy-Authorization";
if (request->creds[TARGET_PROXY][scheme].username)
{
username = request->creds[TARGET_PROXY][scheme].username;
@@ -1362,19 +1293,15 @@ static BOOL do_authorization( struct request *request, DWORD target, DWORD schem
static WCHAR *build_proxy_connect_string( struct request *request )
{
- static const WCHAR fmtW[] = {'%','s',':','%','u',0};
- static const WCHAR connectW[] = {'C','O','N','N','E','C','T', 0};
- static const WCHAR spaceW[] = {' ',0}, crlfW[] = {'\r','\n',0}, colonW[] = {':',' ',0};
- static const WCHAR twocrlfW[] = {'\r','\n','\r','\n',0};
WCHAR *ret, *host;
unsigned int i;
int len = lstrlenW( request->connect->hostname ) + 7;
if (!(host = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
- len = swprintf( host, len, fmtW, request->connect->hostname, request->connect->hostport );
+ len = swprintf( host, len, L"%s:%u", request->connect->hostname, request->connect->hostport );
- len += ARRAY_SIZE(connectW);
- len += ARRAY_SIZE(http1_1);
+ len += ARRAY_SIZE(L"CONNECT");
+ len += ARRAY_SIZE(L"HTTP/1.1");
for (i = 0; i < request->num_headers; i++)
{
@@ -1385,23 +1312,23 @@ static WCHAR *build_proxy_connect_string( struct request *request )
if ((ret = heap_alloc( (len + 1) * sizeof(WCHAR) )))
{
- lstrcpyW( ret, connectW );
- lstrcatW( ret, spaceW );
+ lstrcpyW( ret, L"CONNECT" );
+ lstrcatW( ret, L" " );
lstrcatW( ret, host );
- lstrcatW( ret, spaceW );
- lstrcatW( ret, http1_1 );
+ lstrcatW( ret, L" " );
+ lstrcatW( ret, L"HTTP/1.1" );
for (i = 0; i < request->num_headers; i++)
{
if (request->headers[i].is_request)
{
- lstrcatW( ret, crlfW );
+ lstrcatW( ret, L"\r\n" );
lstrcatW( ret, request->headers[i].field );
- lstrcatW( ret, colonW );
+ lstrcatW( ret, L": " );
lstrcatW( ret, request->headers[i].value );
}
}
- lstrcatW( ret, twocrlfW );
+ lstrcatW( ret, L"\r\n\r\n" );
}
heap_free( host );
@@ -1768,7 +1695,6 @@ static BOOL add_host_header( struct request *request, DWORD modifier )
BOOL ret;
DWORD len;
WCHAR *host;
- static const WCHAR fmt[] = {'%','s',':','%','u',0};
struct connect *connect = request->connect;
INTERNET_PORT port;
@@ -1776,12 +1702,12 @@ static BOOL add_host_header( struct request *request, DWORD modifier )
if (port == INTERNET_DEFAULT_HTTP_PORT || port == INTERNET_DEFAULT_HTTPS_PORT)
{
- return process_header( request, attr_host, connect->hostname, modifier, TRUE );
+ return process_header( request, L"Host", connect->hostname, modifier, TRUE );
}
len = lstrlenW( connect->hostname ) + 7; /* sizeof(":65335") */
if (!(host = heap_alloc( len * sizeof(WCHAR) ))) return FALSE;
- swprintf( host, len, fmt, connect->hostname, port );
- ret = process_header( request, attr_host, host, modifier, TRUE );
+ swprintf( host, len, L"%s:%u", connect->hostname, port );
+ ret = process_header( request, L"Host", host, modifier, TRUE );
heap_free( host );
return ret;
}
@@ -1921,8 +1847,6 @@ static BOOL refill_buffer( struct request *request, BOOL notify )
static void finished_reading( struct request *request )
{
- static const WCHAR closeW[] = {'c','l','o','s','e',0};
-
BOOL close = FALSE;
WCHAR connection[20];
DWORD size = sizeof(connection);
@@ -1933,9 +1857,9 @@ static void finished_reading( struct request *request )
else if (query_headers( request, WINHTTP_QUERY_CONNECTION, NULL, connection, &size, NULL ) ||
query_headers( request, WINHTTP_QUERY_PROXY_CONNECTION, NULL, connection, &size, NULL ))
{
- if (!wcsicmp( connection, closeW )) close = TRUE;
+ if (!wcsicmp( connection, L"close" )) close = TRUE;
}
- else if (!wcscmp( request->version, http1_0 )) close = TRUE;
+ else if (!wcscmp( request->version, L"HTTP/1.0" )) close = TRUE;
if (close)
{
close_connection( request );
@@ -2199,10 +2123,6 @@ static char *build_wire_request( struct request *request, DWORD *len )
static BOOL send_request( struct request *request, const WCHAR *headers, DWORD headers_len, void *optional,
DWORD optional_len, DWORD total_len, DWORD_PTR context, BOOL async )
{
- static const WCHAR keep_alive[] = {'K','e','e','p','-','A','l','i','v','e',0};
- static const WCHAR no_cache[] = {'n','o','-','c','a','c','h','e',0};
- static const WCHAR length_fmt[] = {'%','l','d',0};
-
BOOL ret = FALSE;
struct connect *connect = request->connect;
struct session *session = connect->session;
@@ -2214,7 +2134,7 @@ static BOOL send_request( struct request *request, const WCHAR *headers, DWORD h
drain_content( request );
if (session->agent)
- process_header( request, attr_user_agent, session->agent, WINHTTP_ADDREQ_FLAG_ADD_IF_NEW, TRUE );
+ process_header( request, L"User-Agent", session->agent, WINHTTP_ADDREQ_FLAG_ADD_IF_NEW, TRUE );
if (connect->hostname)
add_host_header( request, WINHTTP_ADDREQ_FLAG_ADD_IF_NEW );
@@ -2222,20 +2142,20 @@ static BOOL send_request( struct request *request, const WCHAR *headers, DWORD h
if (request->creds[TARGET_SERVER][SCHEME_BASIC].username)
do_authorization( request, WINHTTP_AUTH_TARGET_SERVER, WINHTTP_AUTH_SCHEME_BASIC );
- if (total_len || (request->verb && !wcscmp( request->verb, postW )))
+ if (total_len || (request->verb && !wcscmp( request->verb, L"POST" )))
{
WCHAR length[21]; /* decimal long int + null */
- swprintf( length, ARRAY_SIZE(length), length_fmt, total_len );
- process_header( request, attr_content_length, length, WINHTTP_ADDREQ_FLAG_ADD_IF_NEW, TRUE );
+ swprintf( length, ARRAY_SIZE(length), L"%ld", total_len );
+ process_header( request, L"Content-Length", length, WINHTTP_ADDREQ_FLAG_ADD_IF_NEW, TRUE );
}
if (!(request->hdr.disable_flags & WINHTTP_DISABLE_KEEP_ALIVE))
{
- process_header( request, attr_connection, keep_alive, WINHTTP_ADDREQ_FLAG_ADD_IF_NEW, TRUE );
+ process_header( request, L"Connection", L"Keep-Alive", WINHTTP_ADDREQ_FLAG_ADD_IF_NEW, TRUE );
}
if (request->hdr.flags & WINHTTP_FLAG_REFRESH)
{
- process_header( request, attr_pragma, no_cache, WINHTTP_ADDREQ_FLAG_ADD_IF_NEW, TRUE );
- process_header( request, attr_cache_control, no_cache, WINHTTP_ADDREQ_FLAG_ADD_IF_NEW, TRUE );
+ process_header( request, L"Pragma", L"no-cache", WINHTTP_ADDREQ_FLAG_ADD_IF_NEW, TRUE );
+ process_header( request, L"Cache-Control", L"no-cache", WINHTTP_ADDREQ_FLAG_ADD_IF_NEW, TRUE );
}
if (headers && !add_request_headers( request, headers, headers_len, WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE ))
{
@@ -2452,7 +2372,7 @@ static DWORD set_content_length( struct request *request, DWORD status )
WCHAR encoding[20];
DWORD buflen = sizeof(request->content_length);
- if (status == HTTP_STATUS_NO_CONTENT || status == HTTP_STATUS_NOT_MODIFIED || !wcscmp( request->verb, headW ))
+ if (status == HTTP_STATUS_NO_CONTENT || status == HTTP_STATUS_NOT_MODIFIED || !wcscmp( request->verb, L"HEAD" ))
request->content_length = 0;
else
{
@@ -2462,7 +2382,7 @@ static DWORD set_content_length( struct request *request, DWORD status )
buflen = sizeof(encoding);
if (query_headers( request, WINHTTP_QUERY_TRANSFER_ENCODING, NULL, encoding, &buflen, NULL ) &&
- !wcsicmp( encoding, chunkedW ))
+ !wcsicmp( encoding, L"chunked" ))
{
request->content_length = ~0u;
request->read_chunked = TRUE;
@@ -2517,8 +2437,6 @@ static BOOL read_line( struct request *request, char *buffer, DWORD *len )
static BOOL read_reply( struct request *request )
{
- static const WCHAR crlf[] = {'\r','\n',0};
-
char buffer[MAX_REPLY_LEN];
DWORD buflen, len, offset, crlf_len = 2; /* lstrlenW(crlf) */
char *status_code, *status_text;
@@ -2549,7 +2467,7 @@ static BOOL read_reply( struct request *request )
/* we rely on the fact that the protocol is ascii */
MultiByteToWideChar( CP_ACP, 0, status_code, len, status_codeW, len );
status_codeW[len] = 0;
- if (!(process_header( request, attr_status, status_codeW,
+ if (!(process_header( request, L"Status", status_codeW,
WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE, FALSE )))
return FALSE;
@@ -2571,7 +2489,7 @@ static BOOL read_reply( struct request *request )
len = max( buflen + crlf_len, INITIAL_HEADER_BUFFER_LEN );
if (!(raw_headers = heap_alloc( len * sizeof(WCHAR) ))) return FALSE;
MultiByteToWideChar( CP_ACP, 0, buffer, buflen, raw_headers, buflen );
- memcpy( raw_headers + buflen - 1, crlf, sizeof(crlf) );
+ memcpy( raw_headers + buflen - 1, L"\r\n", sizeof(L"\r\n") );
heap_free( request->raw_headers );
request->raw_headers = raw_headers;
@@ -2594,7 +2512,7 @@ static BOOL read_reply( struct request *request )
}
if (!*buffer)
{
- memcpy( raw_headers + offset, crlf, sizeof(crlf) );
+ memcpy( raw_headers + offset, L"\r\n", sizeof(L"\r\n") );
break;
}
MultiByteToWideChar( CP_ACP, 0, buffer, buflen, raw_headers + offset, buflen );
@@ -2606,7 +2524,7 @@ static BOOL read_reply( struct request *request )
break;
}
free_header( header );
- memcpy( raw_headers + offset + buflen - 1, crlf, sizeof(crlf) );
+ memcpy( raw_headers + offset + buflen - 1, L"\r\n", sizeof(L"\r\n") );
offset += buflen + crlf_len - 1;
}
@@ -2621,7 +2539,7 @@ static void record_cookies( struct request *request )
for (i = 0; i < request->num_headers; i++)
{
struct header *set_cookie = &request->headers[i];
- if (!wcsicmp( set_cookie->field, attr_set_cookie ) && !set_cookie->is_request)
+ if (!wcsicmp( set_cookie->field, L"Set-Cookie" ) && !set_cookie->is_request)
{
set_cookies( request, set_cookie->value );
}
@@ -2674,7 +2592,7 @@ static BOOL handle_redirect( struct request *request, DWORD status )
len = lstrlenW( request->path ) + 1 + len_loc;
if (!(path = heap_alloc( (len + 1) * sizeof(WCHAR) ))) goto end;
lstrcpyW( path, request->path );
- lstrcatW( path, slashW );
+ lstrcatW( path, L"/" );
memcpy( path + lstrlenW(path), location, len_loc * sizeof(WCHAR) );
path[len_loc] = 0;
}
@@ -2732,17 +2650,17 @@ static BOOL handle_redirect( struct request *request, DWORD status )
memcpy( request->path, uc.lpszUrlPath, (len + 1) * sizeof(WCHAR) );
request->path[len] = 0;
}
- else request->path = strdupW( slashW );
+ else request->path = strdupW( L"/" );
}
/* remove content-type/length headers */
- if ((index = get_header_index( request, attr_content_type, 0, TRUE )) >= 0) delete_header( request, index );
- if ((index = get_header_index( request, attr_content_length, 0, TRUE )) >= 0 ) delete_header( request, index );
+ if ((index = get_header_index( request, L"Content-Type", 0, TRUE )) >= 0) delete_header( request, index );
+ if ((index = get_header_index( request, L"Content-Length", 0, TRUE )) >= 0 ) delete_header( request, index );
- if (status != HTTP_STATUS_REDIRECT_KEEP_VERB && !wcscmp( request->verb, postW ))
+ if (status != HTTP_STATUS_REDIRECT_KEEP_VERB && !wcscmp( request->verb, L"POST" ))
{
heap_free( request->verb );
- request->verb = strdupW( getW );
+ request->verb = strdupW( L"GET" );
request->optional = NULL;
request->optional_len = 0;
}
@@ -2770,12 +2688,11 @@ static BOOL is_passport_request( struct request *request )
static BOOL handle_passport_redirect( struct request *request )
{
- static const WCHAR status401W[] = {'4','0','1',0};
DWORD flags = WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE;
int i, len = lstrlenW( request->raw_headers );
WCHAR *p = request->raw_headers;
- if (!process_header( request, attr_status, status401W, flags, FALSE )) return FALSE;
+ if (!process_header( request, L"Status", L"401", flags, FALSE )) return FALSE;
for (i = 0; i < len; i++)
{
@@ -3560,13 +3477,9 @@ static HRESULT WINAPI winhttp_request_Open(
BSTR url,
VARIANT async )
{
- static const WCHAR typeW[] = {'*','/','*',0};
- static const WCHAR *acceptW[] = {typeW, NULL};
static const WCHAR httpsW[] = {'h','t','t','p','s'};
- static const WCHAR user_agentW[] = {
- 'M','o','z','i','l','l','a','/','4','.','0',' ','(','c','o','m','p','a','t','i','b','l','e',';',' ',
- 'W','i','n','3','2',';',' ','W','i','n','H','t','t','p','.','W','i','n','H','t','t','p',
- 'R','e','q','u','e','s','t','.','5',')',0};
+ static const WCHAR *acceptW[] = {L"*/*", NULL};
+ static const WCHAR user_agentW[] = L"Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5)";
struct winhttp_request *request = impl_from_IWinHttpRequest( iface );
URL_COMPONENTS uc;
WCHAR *hostname, *path = NULL, *verb = NULL;
@@ -3656,8 +3569,6 @@ static HRESULT WINAPI winhttp_request_SetRequestHeader(
BSTR header,
BSTR value )
{
- static const WCHAR fmtW[] = {'%','s',':',' ','%','s','\r','\n',0};
- static const WCHAR emptyW[] = {0};
struct winhttp_request *request = impl_from_IWinHttpRequest( iface );
DWORD len, err = ERROR_SUCCESS;
WCHAR *str;
@@ -3684,7 +3595,7 @@ static HRESULT WINAPI winhttp_request_SetRequestHeader(
err = ERROR_OUTOFMEMORY;
goto done;
}
- swprintf( str, len + 1, fmtW, header, value ? value : emptyW );
+ swprintf( str, len + 1, L"%s: %s\r\n", header, value ? value : L"" );
if (!WinHttpAddRequestHeaders( request->hrequest, str, len,
WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE ))
{
@@ -3843,7 +3754,7 @@ static HRESULT request_receive( struct winhttp_request *request )
return HRESULT_FROM_WIN32( GetLastError() );
}
if ((err = wait_for_completion( request ))) return HRESULT_FROM_WIN32( err );
- if (!wcscmp( request->verb, headW ))
+ if (!wcscmp( request->verb, L"HEAD" ))
{
request->state = REQUEST_STATE_RESPONSE_RECEIVED;
return S_OK;
@@ -3914,15 +3825,13 @@ static DWORD request_set_parameters( struct winhttp_request *request )
static void request_set_utf8_content_type( struct winhttp_request *request )
{
- static const WCHAR fmtW[] = {'%','s',':',' ','%','s',0};
- static const WCHAR text_plainW[] = {'t','e','x','t','/','p','l','a','i','n',0};
- static const WCHAR charset_utf8W[] = {'c','h','a','r','s','e','t','=','u','t','f','-','8',0};
WCHAR headerW[64];
int len;
- len = swprintf( headerW, ARRAY_SIZE(headerW), fmtW, attr_content_type, text_plainW );
+ len = swprintf( headerW, ARRAY_SIZE(headerW), L"%s: %s", L"Content-Type", L"text/plain" );
WinHttpAddRequestHeaders( request->hrequest, headerW, len, WINHTTP_ADDREQ_FLAG_ADD_IF_NEW );
- len = swprintf( headerW, ARRAY_SIZE(headerW), fmtW, attr_content_type, charset_utf8W );
+
+ len = swprintf( headerW, ARRAY_SIZE(headerW), L"%s: %s", L"Content-Type", L"charset=utf-8" );
WinHttpAddRequestHeaders( request->hrequest, headerW, len, WINHTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON );
}
@@ -3936,7 +3845,7 @@ static HRESULT request_send( struct winhttp_request *request )
DWORD err;
if ((err = request_set_parameters( request ))) return HRESULT_FROM_WIN32( err );
- if (wcscmp( request->verb, getW ))
+ if (wcscmp( request->verb, L"GET" ))
{
VariantInit( &data );
if (V_VT( &request->data ) == VT_BSTR)
@@ -4139,8 +4048,6 @@ done:
static DWORD request_get_codepage( struct winhttp_request *request, UINT *codepage )
{
- static const WCHAR utf8W[] = {'u','t','f','-','8',0};
- static const WCHAR charsetW[] = {'c','h','a','r','s','e','t',0};
WCHAR *buffer, *p;
DWORD size;
@@ -4153,14 +4060,14 @@ static DWORD request_get_codepage( struct winhttp_request *request, UINT *codepa
{
return GetLastError();
}
- if ((p = wcsstr( buffer, charsetW )))
+ if ((p = wcsstr( buffer, L"charset" )))
{
- p += lstrlenW( charsetW );
+ p += lstrlenW( L"charset" );
while (*p == ' ') p++;
if (*p++ == '=')
{
while (*p == ' ') p++;
- if (!wcsicmp( p, utf8W )) *codepage = CP_UTF8;
+ if (!wcsicmp( p, L"utf-8" )) *codepage = CP_UTF8;
}
}
heap_free( buffer );
@@ -4496,9 +4403,7 @@ static HRESULT WINAPI winhttp_request_put_Option(
}
case WinHttpRequestOption_URLCodePage:
{
- static const WCHAR utf8W[] = {'u','t','f','-','8',0};
VARIANT cp;
-
VariantInit( &cp );
hr = VariantChangeType( &cp, &value, 0, VT_UI4 );
if (SUCCEEDED( hr ))
@@ -4506,7 +4411,7 @@ static HRESULT WINAPI winhttp_request_put_Option(
request->url_codepage = V_UI4( &cp );
TRACE("URL codepage: %u\n", request->url_codepage);
}
- else if (V_VT( &value ) == VT_BSTR && !wcsicmp( V_BSTR( &value ), utf8W ))
+ else if (V_VT( &value ) == VT_BSTR && !wcsicmp( V_BSTR( &value ), L"utf-8" ))
{
TRACE("URL codepage: UTF-8\n");
request->url_codepage = CP_UTF8;
diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c
index 690b42ab56..3f8acf0e02 100644
--- a/dlls/winhttp/session.c
+++ b/dlls/winhttp/session.c
@@ -374,10 +374,9 @@ static const struct object_vtbl connect_vtbl =
static BOOL domain_matches(LPCWSTR server, LPCWSTR domain)
{
- static const WCHAR localW[] = { '<','l','o','c','a','l','>',0 };
BOOL ret = FALSE;
- if (!wcsicmp( domain, localW ) && !wcschr( server, '.' ))
+ if (!wcsicmp( domain, L"<local>" ) && !wcschr( server, '.' ))
ret = TRUE;
else if (*domain == '*')
{
@@ -1059,13 +1058,12 @@ static const struct object_vtbl request_vtbl =
static BOOL add_accept_types_header( struct request *request, const WCHAR **types )
{
- static const WCHAR acceptW[] = {'A','c','c','e','p','t',0};
static const DWORD flags = WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA;
if (!types) return TRUE;
while (*types)
{
- if (!process_header( request, acceptW, *types, flags, TRUE )) return FALSE;
+ if (!process_header( request, L"Accept", *types, flags, TRUE )) return FALSE;
types++;
}
return TRUE;
@@ -1141,11 +1139,11 @@ HINTERNET WINAPI WinHttpOpenRequest( HINTERNET hconnect, LPCWSTR verb, LPCWSTR o
request->receive_timeout = connect->session->receive_timeout;
request->receive_response_timeout = connect->session->receive_response_timeout;
- if (!verb || !verb[0]) verb = getW;
+ if (!verb || !verb[0]) verb = L"GET";
if (!(request->verb = strdupW( verb ))) goto end;
if (!(request->path = get_request_path( object ))) goto end;
- if (!version || !version[0]) version = http1_1;
+ if (!version || !version[0]) version = L"HTTP/1.1";
if (!(request->version = strdupW( version ))) goto end;
if (!(add_accept_types_header( request, types ))) goto end;
@@ -1408,8 +1406,6 @@ static int reverse_lookup( const struct addrinfo *ai, char *hostname, size_t len
static WCHAR *build_wpad_url( const char *hostname, const struct addrinfo *ai )
{
- static const WCHAR httpW[] = {'h','t','t','p',':','/','/',0};
- static const WCHAR wpadW[] = {'/','w','p','a','d','.','d','a','t',0};
char name[NI_MAXHOST];
WCHAR *ret, *p;
int len;
@@ -1419,12 +1415,12 @@ static WCHAR *build_wpad_url( const char *hostname, const struct addrinfo *ai )
if (!reverse_lookup( ai, name, sizeof(name) )) hostname = name;
- len = lstrlenW( httpW ) + strlen( hostname ) + lstrlenW( wpadW );
+ len = lstrlenW( L"http://" ) + strlen( hostname ) + lstrlenW( L"/wpad.dat" );
if (!(ret = p = GlobalAlloc( 0, (len + 1) * sizeof(WCHAR) ))) return NULL;
- lstrcpyW( p, httpW );
- p += lstrlenW( httpW );
+ lstrcpyW( p, L"http://" );
+ p += lstrlenW( L"http://" );
while (*hostname) { *p++ = *hostname++; }
- lstrcpyW( p, wpadW );
+ lstrcpyW( p, L"/wpad.dat" );
return ret;
}
@@ -1504,15 +1500,9 @@ BOOL WINAPI WinHttpDetectAutoProxyConfigUrl( DWORD flags, LPWSTR *url )
return TRUE;
}
-static const WCHAR Connections[] = {
- 'S','o','f','t','w','a','r','e','\\',
- 'M','i','c','r','o','s','o','f','t','\\',
- 'W','i','n','d','o','w','s','\\',
- 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
- 'I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s','\\',
- 'C','o','n','n','e','c','t','i','o','n','s',0 };
-static const WCHAR WinHttpSettings[] = {
- 'W','i','n','H','t','t','p','S','e','t','t','i','n','g','s',0 };
+static const WCHAR path_connections[] =
+ L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Connections";
+
static const DWORD WINHTTP_SETTINGS_MAGIC = 0x18;
static const DWORD WININET_SETTINGS_MAGIC = 0x46;
static const DWORD PROXY_TYPE_DIRECT = 1;
@@ -1548,12 +1538,12 @@ BOOL WINAPI WinHttpGetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
TRACE("%p\n", info);
- l = RegOpenKeyExW( HKEY_LOCAL_MACHINE, Connections, 0, KEY_READ, &key );
+ l = RegOpenKeyExW( HKEY_LOCAL_MACHINE, path_connections, 0, KEY_READ, &key );
if (!l)
{
DWORD type, size = 0;
- l = RegQueryValueExW( key, WinHttpSettings, NULL, &type, NULL, &size );
+ l = RegQueryValueExW( key, L"WinHttpSettings", NULL, &type, NULL, &size );
if (!l && type == REG_BINARY &&
size >= sizeof(struct connection_settings_header) + 2 * sizeof(DWORD))
{
@@ -1565,7 +1555,7 @@ BOOL WINAPI WinHttpGetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
(struct connection_settings_header *)buf;
DWORD *len = (DWORD *)(hdr + 1);
- l = RegQueryValueExW( key, WinHttpSettings, NULL, NULL, buf,
+ l = RegQueryValueExW( key, L"WinHttpSettings", NULL, NULL, buf,
&size );
if (!l && hdr->magic == WINHTTP_SETTINGS_MAGIC &&
hdr->unknown == 0)
@@ -1668,8 +1658,6 @@ BOOL WINAPI WinHttpGetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
*/
BOOL WINAPI WinHttpGetIEProxyConfigForCurrentUser( WINHTTP_CURRENT_USER_IE_PROXY_CONFIG *config )
{
- static const WCHAR settingsW[] =
- {'D','e','f','a','u','l','t','C','o','n','n','e','c','t','i','o','n','S','e','t','t','i','n','g','s',0};
HKEY hkey = NULL;
struct connection_settings_header *hdr = NULL;
DWORD type, offset, len, size = 0;
@@ -1685,15 +1673,15 @@ BOOL WINAPI WinHttpGetIEProxyConfigForCurrentUser( WINHTTP_CURRENT_USER_IE_PROXY
memset( config, 0, sizeof(*config) );
config->fAutoDetect = TRUE;
- if (RegOpenKeyExW( HKEY_CURRENT_USER, Connections, 0, KEY_READ, &hkey ) ||
- RegQueryValueExW( hkey, settingsW, NULL, &type, NULL, &size ) ||
+ if (RegOpenKeyExW( HKEY_CURRENT_USER, path_connections, 0, KEY_READ, &hkey ) ||
+ RegQueryValueExW( hkey, L"DefaultConnectionSettings", NULL, &type, NULL, &size ) ||
type != REG_BINARY || size < sizeof(struct connection_settings_header))
{
ret = TRUE;
goto done;
}
if (!(hdr = heap_alloc( size ))) goto done;
- if (RegQueryValueExW( hkey, settingsW, NULL, &type, (BYTE *)hdr, &size ) ||
+ if (RegQueryValueExW( hkey, L"DefaultConnectionSettings", NULL, &type, (BYTE *)hdr, &size ) ||
hdr->magic != WININET_SETTINGS_MAGIC)
{
ret = TRUE;
@@ -1782,8 +1770,7 @@ static BOOL parse_script_result( const char *result, WINHTTP_PROXY_INFO *info )
static char *download_script( const WCHAR *url, DWORD *out_size )
{
- static const WCHAR typeW[] = {'*','/','*',0};
- static const WCHAR *acceptW[] = {typeW, NULL};
+ static const WCHAR *acceptW[] = {L"*/*", NULL};
HINTERNET ses, con = NULL, req = NULL;
WCHAR *hostname;
URL_COMPONENTSW uc;
@@ -1996,7 +1983,7 @@ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
return FALSE;
}
- l = RegCreateKeyExW( HKEY_LOCAL_MACHINE, Connections, 0, NULL, 0,
+ l = RegCreateKeyExW( HKEY_LOCAL_MACHINE, path_connections, 0, NULL, 0,
KEY_WRITE, NULL, &key, NULL );
if (!l)
{
@@ -2044,7 +2031,7 @@ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
*len++ = 0;
*len++ = 0;
}
- l = RegSetValueExW( key, WinHttpSettings, 0, REG_BINARY, buf, size );
+ l = RegSetValueExW( key, L"WinHttpSettings", 0, REG_BINARY, buf, size );
if (!l)
ret = TRUE;
heap_free( buf );
@@ -2150,22 +2137,15 @@ BOOL WINAPI WinHttpSetTimeouts( HINTERNET handle, int resolve, int connect, int
}
static const WCHAR wkday[7][4] =
- {{'S','u','n', 0}, {'M','o','n', 0}, {'T','u','e', 0}, {'W','e','d', 0},
- {'T','h','u', 0}, {'F','r','i', 0}, {'S','a','t', 0}};
+ {L"Sun", L"Mon", L"Tue", L"Wed", L"Thu", L"Fri", L"Sat"};
static const WCHAR month[12][4] =
- {{'J','a','n', 0}, {'F','e','b', 0}, {'M','a','r', 0}, {'A','p','r', 0},
- {'M','a','y', 0}, {'J','u','n', 0}, {'J','u','l', 0}, {'A','u','g', 0},
- {'S','e','p', 0}, {'O','c','t', 0}, {'N','o','v', 0}, {'D','e','c', 0}};
+ {L"Jan", L"Feb", L"Mar", L"Apr", L"May", L"Jun", L"Jul", L"Aug", L"Sep", L"Oct", L"Nov", L"Dec"};
/***********************************************************************
* WinHttpTimeFromSystemTime (WININET.@)
*/
BOOL WINAPI WinHttpTimeFromSystemTime( const SYSTEMTIME *time, LPWSTR string )
{
- static const WCHAR format[] =
- {'%','s',',',' ','%','0','2','d',' ','%','s',' ','%','4','d',' ','%','0',
- '2','d',':','%','0','2','d',':','%','0','2','d',' ','G','M','T', 0};
-
TRACE("%p, %p\n", time, string);
if (!time || !string)
@@ -2174,7 +2154,8 @@ BOOL WINAPI WinHttpTimeFromSystemTime( const SYSTEMTIME *time, LPWSTR string )
return FALSE;
}
- swprintf( string, WINHTTP_TIME_FORMAT_BUFSIZE / sizeof(WCHAR), format,
+ swprintf( string, WINHTTP_TIME_FORMAT_BUFSIZE / sizeof(WCHAR),
+ L"%s, %02d %s %4d %02d:%02d:%02d GMT",
wkday[time->wDayOfWeek],
time->wDay,
month[time->wMonth - 1],
diff --git a/dlls/winhttp/url.c b/dlls/winhttp/url.c
index d405090409..ba9ed4366a 100644
--- a/dlls/winhttp/url.c
+++ b/dlls/winhttp/url.c
@@ -29,9 +29,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
-static const WCHAR scheme_http[] = {'h','t','t','p',0};
-static const WCHAR scheme_https[] = {'h','t','t','p','s',0};
-
struct url_component
{
WCHAR **str;
@@ -93,8 +90,7 @@ static WCHAR *decode_url( LPCWSTR url, DWORD *len )
static inline BOOL need_escape( WCHAR ch )
{
- static const WCHAR escapes[] = {' ','"','#','%','<','>','[','\\',']','^','`','{','|','}','~',0};
- const WCHAR *p = escapes;
+ const WCHAR *p = L" \"#%<>[\\]^`{|}~";
if (ch <= 31 || ch >= 127) return TRUE;
while (*p)
@@ -106,7 +102,7 @@ static inline BOOL need_escape( WCHAR ch )
static BOOL escape_string( const WCHAR *src, DWORD src_len, WCHAR *dst, DWORD *dst_len )
{
- static const WCHAR hex[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
+ static const WCHAR hex[] = L"0123456789ABCDEF";
WCHAR *p = dst;
DWORD i;
@@ -214,8 +210,8 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
SetLastError( ERROR_WINHTTP_UNRECOGNIZED_SCHEME );
return FALSE;
}
- if (p - url == 4 && !wcsnicmp( url, scheme_http, 4 )) scheme_number = INTERNET_SCHEME_HTTP;
- else if (p - url == 5 && !wcsnicmp( url, scheme_https, 5 )) scheme_number = INTERNET_SCHEME_HTTPS;
+ if (p - url == 4 && !wcsnicmp( url, L"http", 4 )) scheme_number = INTERNET_SCHEME_HTTP;
+ else if (p - url == 5 && !wcsnicmp( url, L"https", 5 )) scheme_number = INTERNET_SCHEME_HTTPS;
else
{
err = ERROR_WINHTTP_UNRECOGNIZED_SCHEME;
@@ -343,15 +339,15 @@ exit:
static INTERNET_SCHEME get_scheme( const WCHAR *scheme, DWORD len )
{
- if (!wcsncmp( scheme, scheme_http, len )) return INTERNET_SCHEME_HTTP;
- if (!wcsncmp( scheme, scheme_https, len )) return INTERNET_SCHEME_HTTPS;
+ if (!wcsncmp( scheme, L"http", len )) return INTERNET_SCHEME_HTTP;
+ if (!wcsncmp( scheme, L"https", len )) return INTERNET_SCHEME_HTTPS;
return 0;
}
static const WCHAR *get_scheme_string( INTERNET_SCHEME scheme )
{
- if (scheme == INTERNET_SCHEME_HTTP) return scheme_http;
- if (scheme == INTERNET_SCHEME_HTTPS) return scheme_https;
+ if (scheme == INTERNET_SCHEME_HTTP) return L"http";
+ if (scheme == INTERNET_SCHEME_HTTPS) return L"https";
return NULL;
}
@@ -375,7 +371,6 @@ static DWORD get_comp_length( DWORD len, DWORD flags, WCHAR *comp )
static BOOL get_url_length( URL_COMPONENTS *uc, DWORD flags, DWORD *len )
{
- static const WCHAR formatW[] = {'%','u',0};
INTERNET_SCHEME scheme;
*len = 0;
@@ -419,7 +414,7 @@ static BOOL get_url_length( URL_COMPONENTS *uc, DWORD flags, DWORD *len )
{
WCHAR port[sizeof("65535")];
- *len += swprintf( port, ARRAY_SIZE(port), formatW, uc->nPort );
+ *len += swprintf( port, ARRAY_SIZE(port), L"%u", uc->nPort );
*len += 1; /* ":" */
}
if (uc->lpszUrlPath && *uc->lpszUrlPath != '/') *len += 1; /* '/' */
@@ -434,7 +429,6 @@ static BOOL get_url_length( URL_COMPONENTS *uc, DWORD flags, DWORD *len )
*/
BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDWORD required )
{
- static const WCHAR formatW[] = {'%','u',0};
DWORD len, len_escaped;
INTERNET_SCHEME scheme;
@@ -511,7 +505,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
if (!uses_default_port( scheme, uc->nPort ))
{
*url++ = ':';
- url += swprintf( url, sizeof("65535"), formatW, uc->nPort );
+ url += swprintf( url, sizeof("65535"), L"%u", uc->nPort );
}
/* add slash between hostname and path if necessary */
diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h
index a820241734..b3f7092d85 100644
--- a/dlls/winhttp/winhttp_private.h
+++ b/dlls/winhttp/winhttp_private.h
@@ -26,14 +26,6 @@
#include "sspi.h"
#include "wincrypt.h"
-static const WCHAR getW[] = {'G','E','T',0};
-static const WCHAR postW[] = {'P','O','S','T',0};
-static const WCHAR headW[] = {'H','E','A','D',0};
-static const WCHAR slashW[] = {'/',0};
-static const WCHAR http1_0[] = {'H','T','T','P','/','1','.','0',0};
-static const WCHAR http1_1[] = {'H','T','T','P','/','1','.','1',0};
-static const WCHAR chunkedW[] = {'c','h','u','n','k','e','d',0};
-
struct object_header;
struct object_vtbl
{
--
2.20.1
1
0
[PATCH 1/2] winedbg: Use correct CALL operand size when fetching the delta.
by Conor McCarthy 22 Nov '19
by Conor McCarthy 22 Nov '19
22 Nov '19
Signed-off-by: Conor McCarthy <cmccarthy(a)codeweavers.com>
---
programs/winedbg/be_x86_64.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/programs/winedbg/be_x86_64.c b/programs/winedbg/be_x86_64.c
index 2346bc4d..5b95cefa 100644
--- a/programs/winedbg/be_x86_64.c
+++ b/programs/winedbg/be_x86_64.c
@@ -356,14 +356,14 @@ static BOOL fetch_value(const char* addr, unsigned sz, int* value)
switch (sz)
{
- case 8:
+ case 1:
if (!dbg_read_memory(addr, &value8, sizeof(value8))) return FALSE;
*value = value8;
break;
- case 16:
+ case 2:
if (!dbg_read_memory(addr, &value16, sizeof(value16))) return FALSE;
*value = value16;
- case 32:
+ case 4:
if (!dbg_read_memory(addr, value, sizeof(*value))) return FALSE;
break;
default: return FALSE;
--
2.24.0
1
1
They are needed for patches that don't impact the Windows tests and
thus are more likely to be needed next than Windows VMs.
The build VMs should still remain in the top spot because delaying
their tasks delays all the corresponding Windows tasks, which would
leave the TestBot partially idle.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/lib/WineTestBot/Engine/Scheduler.pm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/testbot/lib/WineTestBot/Engine/Scheduler.pm b/testbot/lib/WineTestBot/Engine/Scheduler.pm
index b6a89984c..c28e14331 100644
--- a/testbot/lib/WineTestBot/Engine/Scheduler.pm
+++ b/testbot/lib/WineTestBot/Engine/Scheduler.pm
@@ -411,9 +411,9 @@ sub _CheckAndClassifyVMs()
$VM->Role eq "winetest" ? 10 :
20) + # extra
($VM->Type eq "build" ? 0 :
- $VM->Type eq "win64" ? 1 :
- $VM->Type eq "win32" ? 2 :
- 3); # wine
+ $VM->Type eq "wine" ? 1 :
+ $VM->Type eq "win64" ? 2 :
+ 3); # win32
}
# If a VM was in an inconsistent state, update the jobs status fields before
--
2.20.1
1
0
Signed-off-by: Jeff Smith <whydoubt(a)gmail.com>
---
dlls/msvcrt/time.c | 27 ++++++++++++++-------------
dlls/ucrtbase/tests/misc.c | 12 ++++++------
2 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c
index 4248fe4f85..8534738406 100644
--- a/dlls/msvcrt/time.c
+++ b/dlls/msvcrt/time.c
@@ -1190,6 +1190,7 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max,
{
MSVCRT_size_t ret, tmp;
BOOL alternate;
+ int year = mstm ? mstm->tm_year + 1900 : -1;
if(!str || !format) {
if(str && max)
@@ -1272,8 +1273,9 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max,
break;
#if _MSVCR_VER>=140
case 'C':
- tmp = (1900+mstm->tm_year)/100;
- if(!strftime_int(str, &ret, max, tmp, alternate ? 0 : 2, 0, 99))
+ if(!MSVCRT_CHECK_PMT(year>=0 && year<=9999))
+ goto einval_error;
+ if(!strftime_int(str, &ret, max, year/100, alternate ? 0 : 2, 0, 99))
return 0;
break;
#endif
@@ -1283,6 +1285,8 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max,
break;
#if _MSVCR_VER>=140
case 'D':
+ if(!MSVCRT_CHECK_PMT(year>=0 && year<=9999))
+ goto einval_error;
if(!strftime_int(str, &ret, max, mstm->tm_mon+1, alternate ? 0 : 2, 1, 12))
return 0;
if(ret < max)
@@ -1291,7 +1295,7 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max,
return 0;
if(ret < max)
str[ret++] = '/';
- if(!strftime_int(str, &ret, max, mstm->tm_year%100, alternate ? 0 : 2, 0, 99))
+ if(!strftime_int(str, &ret, max, year%100, alternate ? 0 : 2, 0, 99))
return 0;
break;
case 'e':
@@ -1301,8 +1305,7 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max,
str[ret-2] = ' ';
break;
case 'F':
- tmp = 1900+mstm->tm_year;
- if(!strftime_int(str, &ret, max, tmp, alternate ? 0 : 4, 0, 9999))
+ if(!strftime_int(str, &ret, max, year, alternate ? 0 : 4, 0, 9999))
return 0;
if(ret < max)
str[ret++] = '-';
@@ -1315,7 +1318,7 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max,
break;
case 'g':
case 'G':
- tmp = 1900 + mstm->tm_year;
+ tmp = year;
if (mstm->tm_yday - (mstm->tm_wday ? mstm->tm_wday : 7) + 4 < 0)
tmp--;
else if(mstm->tm_yday - (mstm->tm_wday ? mstm->tm_wday : 7) + 5 > 365 + IsLeapYear(tmp))
@@ -1409,18 +1412,16 @@ static MSVCRT_size_t strftime_impl(STRFTIME_CHAR *str, MSVCRT_size_t max,
break;
case 'y':
#if _MSVCR_VER>=140
- if(!MSVCRT_CHECK_PMT(mstm->tm_year>=-1900 && mstm->tm_year<=8099))
- goto einval_error;
- tmp = (mstm->tm_year+1900)%100;
+ if(!MSVCRT_CHECK_PMT(year>=0 && year<=9999))
#else
- tmp = mstm->tm_year%100;
+ if(!MSVCRT_CHECK_PMT(year>=1900))
#endif
- if(!strftime_int(str, &ret, max, tmp, alternate ? 0 : 2, 0, 99))
+ goto einval_error;
+ if(!strftime_int(str, &ret, max, year%100, alternate ? 0 : 2, 0, 99))
return 0;
break;
case 'Y':
- tmp = 1900+mstm->tm_year;
- if(!strftime_int(str, &ret, max, tmp, alternate ? 0 : 4, 0, 9999))
+ if(!strftime_int(str, &ret, max, year, alternate ? 0 : 4, 0, 9999))
return 0;
break;
case 'z':
diff --git a/dlls/ucrtbase/tests/misc.c b/dlls/ucrtbase/tests/misc.c
index debf0b87a0..9c5045b66a 100644
--- a/dlls/ucrtbase/tests/misc.c
+++ b/dlls/ucrtbase/tests/misc.c
@@ -930,23 +930,23 @@ static void test_strftime(void)
BOOL todo;
BOOL todo_handler;
} tests[] = {
- {"%C", "", { 0, 0, 0, 1, 0, -2000, 4, 0, 0 }, FALSE, TRUE},
- {"%C", "", { 0, 0, 0, 1, 0, -1901, 4, 0, 0 }, TRUE},
+ {"%C", "", { 0, 0, 0, 1, 0, -2000, 4, 0, 0 }},
+ {"%C", "", { 0, 0, 0, 1, 0, -1901, 4, 0, 0 }},
{"%C", "00", { 0, 0, 0, 1, 0, -1900, 4, 0, 0 }},
{"%C", "18", { 0, 0, 0, 1, 0, -1, 4, 0, 0 }},
{"%C", "19", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%C", "99", { 0, 0, 0, 1, 0, 8099, 4, 0, 0 }},
- {"%C", "", { 0, 0, 0, 1, 0, 8100, 4, 0, 0 }, FALSE, TRUE},
+ {"%C", "", { 0, 0, 0, 1, 0, 8100, 4, 0, 0 }},
{"%d", "", { 0, 0, 0, 0, 0, 70, 4, 0, 0 }, TRUE},
{"%d", "01", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%d", "31", { 0, 0, 0, 31, 0, 70, 4, 0, 0 }},
{"%d", "", { 0, 0, 0, 32, 0, 70, 4, 0, 0 }, FALSE, TRUE},
- {"%D", "", { 0, 0, 0, 1, 0, -1901, 4, 0, 0 }, FALSE, TRUE},
+ {"%D", "", { 0, 0, 0, 1, 0, -1901, 4, 0, 0 }},
{"%D", "01/01/00", { 0, 0, 0, 1, 0, -1900, 4, 0, 0 }},
- {"%D", "01/01/99", { 0, 0, 0, 1, 0, -1, 4, 0, 0 }, TRUE},
+ {"%D", "01/01/99", { 0, 0, 0, 1, 0, -1, 4, 0, 0 }},
{"%D", "01/01/70", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%D", "01/01/99", { 0, 0, 0, 1, 0, 8099, 4, 0, 0 }},
- {"%D", "", { 0, 0, 0, 1, 0, 8100, 4, 0, 0 }, TRUE},
+ {"%D", "", { 0, 0, 0, 1, 0, 8100, 4, 0, 0 }},
{"%#D", "1/1/70", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%e", "", { 0, 0, 0, 0, 0, 70, 4, 0, 0 }, TRUE},
{"%e", " 1", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
--
2.23.0
3
14