wfreerdp-server: merged cmakelists

This commit is contained in:
Corey C 2012-09-20 14:33:52 -04:00
commit 8b85033810
29 changed files with 1923 additions and 317 deletions

1
.gitignore vendored
View File

@ -31,6 +31,7 @@ client/X11/xfreerdp.1
*.opensdf
ipch
Debug
RelWithDebInfo
# Binaries
*.a

View File

@ -129,6 +129,14 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-h</term>
<listitem>
<para>
Print help.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-k <replaceable class="parameter">id</replaceable></term>
<listitem>
@ -256,6 +264,12 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-X <replaceable class="parameter">xid</replaceable></term>
<listitem>
<para>embed xfreerdp into window with <replaceable class="parameter">xid</replaceable>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-z</term>
<listitem>
@ -272,14 +286,6 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--ext</term>
<listitem>
<para>
load an extension
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-auth</term>
<listitem>
@ -299,12 +305,41 @@
</listitem>
</varlistentry>
<varlistentry>
<term>--from-stdin</term>
<term>--bcv3 <replaceable class="parameter">codec</replaceable></term>
<listitem>
<para>Use <replaceable class="parameter">codec</replaceable> for bitmap cache v3
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-bmp-cache</term>
<listitem>
<para>
Prompts for unspecified arguments -u username, -p password, -d domain and connection host.
This is useful to hide arguments from ps. Also useful for scripts that will feed these arguments
to the client via (what else?) stdin.
Disable bitmap cache.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--certificate-name <replaceable class="parameter">name</replaceable></term>
<listitem>
<para>
use <replaceable class="parameter">name</replaceable> for the logon certificate, instead of the server name
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--composition</term>
<listitem>
<para>
Enable composition (RDVH only, not to be confused with remote composition).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--ext <replaceable class="parameter">extname</replaceable></term>
<listitem>
<para>
load extension <replaceable class="parameter">extname</replaceable>
</para>
</listitem>
</varlistentry>
@ -319,10 +354,20 @@
</listitem>
</varlistentry>
<varlistentry>
<term>--no-motion</term>
<term>--from-stdin</term>
<listitem>
<para>Prompts for unspecified arguments -u username, -p
password, -d domain and connection host. This is useful to
hide arguments from ps. Also useful for scripts that will
feed these arguments to the client via (what else?) stdin.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--disable-full-window-drag</term>
<listitem>
<para>
Don't send mouse motion events.
Disable full window drag.
</para>
</listitem>
</varlistentry>
@ -334,6 +379,61 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--ignore-certificate</term>
<listitem>
<para>
ignore verification of logon certificate.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--kbd-list</term>
<listitem>
<para>
list all keyboard layout ids used by -k
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--disable-menu-animations</term>
<listitem>
<para>
Disable menu animations.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-motion</term>
<listitem>
<para>
Don't send mouse motion events.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-nego</term>
<listitem>
<para>disable negotiation of security layer and enforce highest enabled security protocol.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-nla</term>
<listitem>
<para>
Disable network level authentication.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--nsc</term>
<listitem>
<para>
Enable NSCodec.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-osb</term>
<listitem>
@ -343,10 +443,18 @@
</listitem>
</varlistentry>
<varlistentry>
<term>--no-bmp-cache</term>
<term>--pcb <replaceable class="parameter">blob</replaceable></term>
<listitem>
<para>
Disable bitmap cache.
Use preconnection <replaceable class="parameter">blob</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--pcid <replaceable class="parameter">id</replaceable></term>
<listitem>
<para>
Use preconnection <replaceable class="parameter">id</replaceable>.
</para>
</listitem>
</varlistentry>
@ -358,6 +466,14 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-rdp</term>
<listitem>
<para>
Disable Standard RDP encryption.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--rfx</term>
<listitem>
@ -375,82 +491,10 @@
</listitem>
</varlistentry>
<varlistentry>
<term>--nsc</term>
<term>--no-salted-checksum</term>
<listitem>
<para>
Enable NSCodec.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--disable-wallpaper</term>
<listitem>
<para>
Disable wallpaper.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--composition</term>
<listitem>
<para>
Enable composition (RDVH only, not to be confused with remote composition).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--disable-full-window-drag</term>
<listitem>
<para>
Disable full window drag.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--disable-menu-animations</term>
<listitem>
<para>
Disable menu animations.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--disable-theming</term>
<listitem>
<para>
Disable theming.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-rdp</term>
<listitem>
<para>
Disable Standard RDP encryption.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-tls</term>
<listitem>
<para>
Disable TLS encryption.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-nla</term>
<listitem>
<para>
Disable network level authentication.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--sec <replaceable class="parameter">proto</replaceable></term>
<listitem>
<para>
force protocol security. <replaceable class="parameter">proto</replaceable> can be one of rdp, tls or nla.
disable salted checksums with Standard RDP encryption.
</para>
</listitem>
</varlistentry>
@ -463,35 +507,57 @@
</listitem>
</varlistentry>
<varlistentry>
<term>--ignore-certificate</term>
<term>--sec <replaceable class="parameter">proto</replaceable></term>
<listitem>
<para>
ignore verification of logon certificate.
force protocol security. <replaceable class="parameter">proto</replaceable> can be one of rdp, tls or nla.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--certificate-name</term>
<term>--disable-theming</term>
<listitem>
<para>
use this name for the logon certificate, instead of the server name
Disable theming.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--kbd-list</term>
<term>--no-tls</term>
<listitem>
<para>
list all keyboard layout ids used by -k
Disable TLS encryption.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--version</term>
<term>--tsg
<replaceable class="parameter">username</replaceable>
<replaceable class="parameter">password</replaceable>
<replaceable class="parameter">hostname</replaceable> </term>
<listitem>
<para>
Use Terminal Server Gateway with
<replaceable class="parameter">username</replaceable>
<replaceable class="parameter">password</replaceable>
<replaceable class="parameter">hostname</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--version</term>
<listitem>
<para>
Print version information.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--disable-wallpaper</term>
<listitem>
<para>
Disable wallpaper.
</para>
</listitem>
</varlistentry>
</variablelist>

View File

@ -13,7 +13,7 @@ endif()
if(MSVC)
option(WITH_NATIVE_SSPI "Use native SSPI modules" ON)
option(WITH_MSVC_STATIC "Use static MSVC runtime" OFF)
option(WITH_WIN8 "Required for wfreedrp-server on windows 8" OFF)
option(WITH_WIN8 "Use Windows 8 libraries" OFF)
endif()
if(${CMAKE_VERSION} VERSION_GREATER 2.8.8)

View File

@ -619,7 +619,7 @@ rdpChannels* freerdp_channels_new(void)
channels->sync_data_mutex = CreateMutex(NULL, FALSE, NULL);
channels->sync_data_list = list_new();
channels->event_sem = CreateSemaphore(NULL, 0, 1, NULL);
channels->event_sem = CreateSemaphore(NULL, 1, 16, NULL);
channels->signal = wait_obj_new();
/* Add it to the global list */

View File

@ -1,9 +1,7 @@
# FreeRDP: A Remote Desktop Protocol Client
# FreeRDP Windows Server cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -35,6 +33,7 @@ set(WFREERDP_SERVER_SRCS
wf_settings.c
wf_settings.h
wf_info.c
wf_info.h)
if(WITH_SERVER_INTERFACE)
@ -44,16 +43,13 @@ else()
set(WFREERDP_SERVER_SRCS ${WFREERDP_SERVER_SRCS} cli/wfreerdp.c cli/wfreerdp.h)
add_executable(wfreerdp-server ${WFREERDP_SERVER_SRCS})
endif()
if(WITH_WIN8)
set(WFREERDP_SERVER_LIBS
d3d11.lib
dxgi.lib
dxguid.lib)
if(WITH_WIN8)
set(WFREERDP_SERVER_LIBS d3d11 dxgi dxguid)
endif()
if(WITH_MONOLITHIC_BUILD)
set(WFREERDP_SERVER_LIBS ${WFREERDP_SERVER_LIBS} freerdp)
set(WFREERDP_SERVER_LIBS ${WFREERDP_SERVER_LIBS} freerdp)
else()
set(WFREERDP_SERVER_LIBS ${WFREERDP_SERVER_LIBS}
freerdp-core

View File

@ -16,6 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@ -32,7 +33,7 @@
#include <tchar.h>
#include "wf_dxgi.h"
// Driver types supported
/* Driver types supported */
D3D_DRIVER_TYPE DriverTypes[] =
{
D3D_DRIVER_TYPE_HARDWARE,
@ -41,7 +42,7 @@ D3D_DRIVER_TYPE DriverTypes[] =
};
UINT NumDriverTypes = ARRAYSIZE(DriverTypes);
// Feature levels supported
/* Feature levels supported */
D3D_FEATURE_LEVEL FeatureLevels[] =
{
D3D_FEATURE_LEVEL_11_0,
@ -49,91 +50,77 @@ D3D_FEATURE_LEVEL FeatureLevels[] =
D3D_FEATURE_LEVEL_10_0,
D3D_FEATURE_LEVEL_9_1
};
UINT NumFeatureLevels = ARRAYSIZE(FeatureLevels);
D3D_FEATURE_LEVEL FeatureLevel;
ID3D11Device* MeinDevice = NULL;
ID3D11DeviceContext* MeinContext = NULL;
IDXGIOutputDuplication* MeinDeskDupl = NULL;
ID3D11Texture2D* MeinAcquiredDesktopImage = NULL;
ID3D11Device* gDevice = NULL;
ID3D11DeviceContext* gContext = NULL;
IDXGIOutputDuplication* gOutputDuplication = NULL;
ID3D11Texture2D* gAcquiredDesktopImage = NULL;
IDXGISurface* surf;
ID3D11Texture2D * sStage;
ID3D11Texture2D* sStage;
DXGI_OUTDUPL_FRAME_INFO FrameInfo;
int wf_dxgi_init(wfInfo* context)
{
HRESULT hr;
HRESULT status;
UINT dTop, i = 0;
DXGI_OUTPUT_DESC desc;
IDXGIOutput * pOutput;
UINT DriverTypeIndex;
IDXGIDevice* DxgiDevice = NULL;
IDXGIAdapter* DxgiAdapter = NULL;
DXGI_OUTPUT_DESC desc;
UINT dTop, i = 0;
IDXGIOutput * pOutput;
IDXGIOutput* DxgiOutput = NULL;
IDXGIOutput1* DxgiOutput1 = NULL;
gAcquiredDesktopImage = NULL;
/////////////////////////////////////////////////////////
//guessing this must be null
MeinAcquiredDesktopImage = NULL;
// Create device
for (DriverTypeIndex = 0; DriverTypeIndex < NumDriverTypes; ++DriverTypeIndex)
{
hr = D3D11CreateDevice(NULL, DriverTypes[DriverTypeIndex], NULL, D3D11_CREATE_DEVICE_DEBUG, FeatureLevels, NumFeatureLevels,
D3D11_SDK_VERSION, &MeinDevice, &FeatureLevel, &MeinContext);
if (SUCCEEDED(hr))
{
// Device creation success, no need to loop anymore
status = D3D11CreateDevice(NULL, DriverTypes[DriverTypeIndex], NULL, D3D11_CREATE_DEVICE_DEBUG, FeatureLevels, NumFeatureLevels,
D3D11_SDK_VERSION, &gDevice, &FeatureLevel, &gContext);
if (SUCCEEDED(status))
break;
}
}
if (FAILED(hr))
if (FAILED(status))
{
_tprintf(_T("Failed to create device in InitializeDx\n"));
return 1;
}
///////////////////////////////////////////////////////
hr = MeinDevice->lpVtbl->QueryInterface(MeinDevice, &IID_IDXGIDevice, (void**) &DxgiDevice);
if (FAILED(hr))
{
status = gDevice->lpVtbl->QueryInterface(gDevice, &IID_IDXGIDevice, (void**) &DxgiDevice);
if (FAILED(status))
{
_tprintf(_T("Failed to get QI for DXGI Device\n"));
return 1;
}
//////////////////////////////////////////////////////////
hr = DxgiDevice->lpVtbl->GetParent(DxgiDevice, &IID_IDXGIAdapter, (void**) &DxgiAdapter);
DxgiDevice->lpVtbl->Release(DxgiDevice);
DxgiDevice = NULL;
if (FAILED(hr))
{
_tprintf(_T("Failed to get parent DXGI Adapter\n"));
return 1;
}
}
////////////////////////////////////////////////////////////
status = DxgiDevice->lpVtbl->GetParent(DxgiDevice, &IID_IDXGIAdapter, (void**) &DxgiAdapter);
DxgiDevice->lpVtbl->Release(DxgiDevice);
DxgiDevice = NULL;
memset(&desc, 0, sizeof(desc));
if (FAILED(status))
{
_tprintf(_T("Failed to get parent DXGI Adapter\n"));
return 1;
}
ZeroMemory(&desc, sizeof(desc));
pOutput = NULL;
while(DxgiAdapter->lpVtbl->EnumOutputs(DxgiAdapter, i, &pOutput) != DXGI_ERROR_NOT_FOUND)
while (DxgiAdapter->lpVtbl->EnumOutputs(DxgiAdapter, i, &pOutput) != DXGI_ERROR_NOT_FOUND)
{
DXGI_OUTPUT_DESC* pDesc = &desc;
hr = pOutput->lpVtbl->GetDesc(pOutput, pDesc);
if (FAILED(hr))
status = pOutput->lpVtbl->GetDesc(pOutput, pDesc);
if (FAILED(status))
{
_tprintf(_T("Failed to get description\n"));
return 1;
@ -141,85 +128,83 @@ int wf_dxgi_init(wfInfo* context)
_tprintf(_T("Output %d: [%s] [%d]\n"), i, pDesc->DeviceName, pDesc->AttachedToDesktop);
if(pDesc->AttachedToDesktop)
if (pDesc->AttachedToDesktop)
dTop = i;
pOutput->lpVtbl->Release(pOutput);
++i;
}
//for now stick to the first one -- need to change this for multimon
dTop = 0;
hr = DxgiAdapter->lpVtbl->EnumOutputs(DxgiAdapter, dTop, &DxgiOutput);
DxgiAdapter->lpVtbl->Release(DxgiAdapter);
DxgiAdapter = NULL;
if (FAILED(hr))
{
_tprintf(_T("Failed to get output\n"));
status = DxgiAdapter->lpVtbl->EnumOutputs(DxgiAdapter, dTop, &DxgiOutput);
DxgiAdapter->lpVtbl->Release(DxgiAdapter);
DxgiAdapter = NULL;
if (FAILED(status))
{
_tprintf(_T("Failed to get output\n"));
return 1;
}
//////////////////////////////////////////////
hr = DxgiOutput->lpVtbl->QueryInterface(DxgiOutput, &IID_IDXGIOutput1, (void**) &DxgiOutput1);
status = DxgiOutput->lpVtbl->QueryInterface(DxgiOutput, &IID_IDXGIOutput1, (void**) &DxgiOutput1);
DxgiOutput->lpVtbl->Release(DxgiOutput);
DxgiOutput = NULL;
if (FAILED(hr))
{
_tprintf(_T("Failed to get IDXGIOutput1\n"));
return 1;
}
DxgiOutput = NULL;
//////////////////////////////////////////////
if (FAILED(status))
{
_tprintf(_T("Failed to get IDXGIOutput1\n"));
return 1;
}
hr = DxgiOutput1->lpVtbl->DuplicateOutput(DxgiOutput1, (IUnknown*)MeinDevice, &MeinDeskDupl);
status = DxgiOutput1->lpVtbl->DuplicateOutput(DxgiOutput1, (IUnknown*)gDevice, &gOutputDuplication);
DxgiOutput1->lpVtbl->Release(DxgiOutput1);
DxgiOutput1 = NULL;
if (FAILED(hr))
{
if (hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE)
{
_tprintf(_T("There is already the maximum number of applications using the Desktop Duplication API running, please close one of those applications and then try again.\n"));
DxgiOutput1 = NULL;
if (FAILED(status))
{
if (status == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE)
{
_tprintf(_T("There is already the maximum number of applications using the Desktop Duplication API running, please close one of those applications and then try again.\n"));
return 1;
}
}
_tprintf(_T("Failed to get duplicate output\n"));
return 1;
}
}
return 0;
}
int wf_dxgi_cleanup(wfInfo* wfi)
{
if(wfi->framesWaiting > 0)
if (wfi->framesWaiting > 0)
{
wf_dxgi_releasePixelData(wfi);
}
if(MeinAcquiredDesktopImage)
if (gAcquiredDesktopImage)
{
MeinAcquiredDesktopImage->lpVtbl->Release(MeinAcquiredDesktopImage);
MeinAcquiredDesktopImage = NULL;
gAcquiredDesktopImage->lpVtbl->Release(gAcquiredDesktopImage);
gAcquiredDesktopImage = NULL;
}
if(MeinDeskDupl)
if (gOutputDuplication)
{
MeinDeskDupl->lpVtbl->Release(MeinDeskDupl);
MeinDeskDupl = NULL;
gOutputDuplication->lpVtbl->Release(gOutputDuplication);
gOutputDuplication = NULL;
}
if(MeinContext)
if(gContext)
{
MeinContext->lpVtbl->Release(MeinContext);
MeinContext = NULL;
gContext->lpVtbl->Release(gContext);
gContext = NULL;
}
if(MeinDevice)
if(gDevice)
{
MeinDevice->lpVtbl->Release(MeinDevice);
MeinDevice = NULL;
gDevice->lpVtbl->Release(gDevice);
gDevice = NULL;
}
return 0;
@ -227,47 +212,49 @@ int wf_dxgi_cleanup(wfInfo* wfi)
int wf_dxgi_nextFrame(wfInfo* wfi, UINT timeout)
{
HRESULT hr;
IDXGIResource* DesktopResource = NULL;
BYTE* MeinMetaDataBuffer = NULL;
UINT MeinMetaDataSize = 0;
HRESULT status;
UINT i = 0;
UINT DataBufferSize = 0;
BYTE* DataBuffer = NULL;
IDXGIResource* DesktopResource = NULL;
if(wfi->framesWaiting > 0)
if (wfi->framesWaiting > 0)
{
wf_dxgi_releasePixelData(wfi);
}
if(MeinAcquiredDesktopImage)
if (gAcquiredDesktopImage)
{
MeinAcquiredDesktopImage->lpVtbl->Release(MeinAcquiredDesktopImage);
MeinAcquiredDesktopImage = NULL;
gAcquiredDesktopImage->lpVtbl->Release(gAcquiredDesktopImage);
gAcquiredDesktopImage = NULL;
}
hr = MeinDeskDupl->lpVtbl->AcquireNextFrame(MeinDeskDupl, timeout, &FrameInfo, &DesktopResource);
if (hr == DXGI_ERROR_WAIT_TIMEOUT)
status = gOutputDuplication->lpVtbl->AcquireNextFrame(gOutputDuplication, timeout, &FrameInfo, &DesktopResource);
if (status == DXGI_ERROR_WAIT_TIMEOUT)
{
return 1;
}
if (FAILED(hr))
if (FAILED(status))
{
_tprintf(_T("Failed to acquire next frame\n"));
hr = MeinDeskDupl->lpVtbl->ReleaseFrame(MeinDeskDupl);
if (FAILED(hr))
status = gOutputDuplication->lpVtbl->ReleaseFrame(gOutputDuplication);
if (FAILED(status))
{
_tprintf(_T("Failed to release frame\n"));
}
return 1;
}
///////////////////////////////////////////////
hr = DesktopResource->lpVtbl->QueryInterface(DesktopResource, &IID_ID3D11Texture2D, (void**) &MeinAcquiredDesktopImage);
status = DesktopResource->lpVtbl->QueryInterface(DesktopResource, &IID_ID3D11Texture2D, (void**) &gAcquiredDesktopImage);
DesktopResource->lpVtbl->Release(DesktopResource);
DesktopResource = NULL;
if (FAILED(hr))
if (FAILED(status))
{
return 1;
}
@ -279,10 +266,10 @@ int wf_dxgi_nextFrame(wfInfo* wfi, UINT timeout)
int wf_dxgi_getPixelData(wfInfo* context, BYTE** data, int* pitch, RECT* invalid)
{
HRESULT hr;
DXGI_MAPPED_RECT MeinData;
D3D11_TEXTURE2D_DESC tDesc;
HRESULT status;
D3D11_BOX Box;
DXGI_MAPPED_RECT mappedRect;
D3D11_TEXTURE2D_DESC tDesc;
tDesc.Width = (invalid->right - invalid->left);
tDesc.Height = (invalid->bottom - invalid->top);
@ -293,7 +280,7 @@ int wf_dxgi_getPixelData(wfInfo* context, BYTE** data, int* pitch, RECT* invalid
tDesc.SampleDesc.Quality = 0;
tDesc.Usage = D3D11_USAGE_STAGING;
tDesc.BindFlags = 0;
tDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;// | D3D11_CPU_ACCESS_WRITE;
tDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
tDesc.MiscFlags = 0;
Box.top = invalid->top;
@ -303,41 +290,44 @@ int wf_dxgi_getPixelData(wfInfo* context, BYTE** data, int* pitch, RECT* invalid
Box.front = 0;
Box.back = 1;
hr = MeinDevice->lpVtbl->CreateTexture2D(MeinDevice, &tDesc, NULL, &sStage);
if (FAILED(hr))
status = gDevice->lpVtbl->CreateTexture2D(gDevice, &tDesc, NULL, &sStage);
if (FAILED(status))
{
_tprintf(_T("Failed to create staging surface\n"));
exit(1);
return 1;
}
MeinContext->lpVtbl->CopySubresourceRegion(MeinContext, (ID3D11Resource*)sStage, 0,0,0,0, (ID3D11Resource*)MeinAcquiredDesktopImage, 0, &Box);
gContext->lpVtbl->CopySubresourceRegion(gContext, (ID3D11Resource*) sStage, 0,0,0,0, (ID3D11Resource*) gAcquiredDesktopImage, 0, &Box);
hr = sStage->lpVtbl->QueryInterface(sStage, &IID_IDXGISurface, (void**)&surf);
if (FAILED(hr))
status = sStage->lpVtbl->QueryInterface(sStage, &IID_IDXGISurface, (void**) &surf);
if (FAILED(status))
{
_tprintf(_T("Failed to QI staging surface\n"));
exit(1);
return 1;
}
surf->lpVtbl->Map(surf, &MeinData, DXGI_MAP_READ);
if (FAILED(hr))
surf->lpVtbl->Map(surf, &mappedRect, DXGI_MAP_READ);
if (FAILED(status))
{
_tprintf(_T("Failed to map staging surface\n"));
exit(1);
return 1;
}
*data = MeinData.pBits;
*pitch = MeinData.Pitch;
*data = mappedRect.pBits;
*pitch = mappedRect.Pitch;
return 0;
}
int wf_dxgi_releasePixelData(wfInfo* wfi)
{
HRESULT hr;
HRESULT status;
surf->lpVtbl->Unmap(surf);
surf->lpVtbl->Release(surf);
@ -345,73 +335,74 @@ int wf_dxgi_releasePixelData(wfInfo* wfi)
sStage->lpVtbl->Release(sStage);
sStage = NULL;
hr = MeinDeskDupl->lpVtbl->ReleaseFrame(MeinDeskDupl);
if (FAILED(hr))
status = gOutputDuplication->lpVtbl->ReleaseFrame(gOutputDuplication);
if (FAILED(status))
{
_tprintf(_T("Failed to release frame\n"));
return 1;
}
wfi->framesWaiting = 0;
return 0;
}
int wf_dxgi_getInvalidRegion(RECT* invalid)
{
HRESULT hr;
UINT MeinMetaDataSize = 0;
UINT BufSize;
UINT i;
BYTE* DirtyRects;
HRESULT status;
UINT dirty;
UINT BufSize;
RECT* pRect;
BYTE* DirtyRects;
UINT DataBufferSize = 0;
BYTE* DataBuffer = NULL;
//optimization note: make this buffer global and allocate only once (or grow only when needed)
BYTE* MeinMetaDataBuffer = NULL;
if(FrameInfo.AccumulatedFrames == 0)
if (FrameInfo.AccumulatedFrames == 0)
{
//we dont care
return 1;
}
if(FrameInfo.TotalMetadataBufferSize)
if (FrameInfo.TotalMetadataBufferSize)
{
if (FrameInfo.TotalMetadataBufferSize > MeinMetaDataSize)
if (FrameInfo.TotalMetadataBufferSize > DataBufferSize)
{
if (MeinMetaDataBuffer)
if (DataBuffer)
{
free(MeinMetaDataBuffer);
MeinMetaDataBuffer = NULL;
free(DataBuffer);
DataBuffer = NULL;
}
MeinMetaDataBuffer = (BYTE*) malloc(FrameInfo.TotalMetadataBufferSize);
if (!MeinMetaDataBuffer)
DataBuffer = (BYTE*) malloc(FrameInfo.TotalMetadataBufferSize);
if (!DataBuffer)
{
MeinMetaDataSize = 0;
DataBufferSize = 0;
_tprintf(_T("Failed to allocate memory for metadata\n"));
exit(1);
}
MeinMetaDataSize = FrameInfo.TotalMetadataBufferSize;
DataBufferSize = FrameInfo.TotalMetadataBufferSize;
}
BufSize = FrameInfo.TotalMetadataBufferSize;
// Get move rectangles
hr = MeinDeskDupl->lpVtbl->GetFrameMoveRects(MeinDeskDupl, BufSize, (DXGI_OUTDUPL_MOVE_RECT*) MeinMetaDataBuffer, &BufSize);
if (FAILED(hr))
status = gOutputDuplication->lpVtbl->GetFrameMoveRects(gOutputDuplication, BufSize, (DXGI_OUTDUPL_MOVE_RECT*) DataBuffer, &BufSize);
if (FAILED(status))
{
_tprintf(_T("Failed to get frame move rects\n"));
return 1;
}
DirtyRects = MeinMetaDataBuffer + BufSize;
DirtyRects = DataBuffer + BufSize;
BufSize = FrameInfo.TotalMetadataBufferSize - BufSize;
// Get dirty rectangles
hr = MeinDeskDupl->lpVtbl->GetFrameDirtyRects(MeinDeskDupl, BufSize, (RECT*) DirtyRects, &BufSize);
if (FAILED(hr))
status = gOutputDuplication->lpVtbl->GetFrameDirtyRects(gOutputDuplication, BufSize, (RECT*) DirtyRects, &BufSize);
if (FAILED(status))
{
_tprintf(_T("Failed to get frame dirty rects\n"));
return 1;
@ -419,6 +410,7 @@ int wf_dxgi_getInvalidRegion(RECT* invalid)
dirty = BufSize / sizeof(RECT);
pRect = (RECT*) DirtyRects;
for(i = 0; i<dirty; ++i)
{
UnionRect(invalid, invalid, pRect);

View File

@ -106,8 +106,6 @@ wfInfo* wf_info_init()
BOOL bOsVersionInfoEx;
*/
wfi = (wfInfo*) malloc(sizeof(wfInfo));
ZeroMemory(wfi, sizeof(wfInfo));
@ -127,6 +125,7 @@ wfInfo* wf_info_init()
}
wfi->updateEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
printf("updateEvent created\n");
wfi->updateSemaphore = CreateSemaphore(NULL, 0, 32, NULL);
@ -187,7 +186,6 @@ wfInfo* wf_info_get_instance()
return wfInfoInstance;
}
void wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
{
if (wf_info_lock(wfi) > 0)
@ -195,16 +193,12 @@ void wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
context->info = wfi;
context->updateEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if(wfi->peerCount == 0)
{
#ifdef WITH_WIN8
if (wfi->peerCount == 0)
wf_dxgi_init(wfi);
#else
wf_mirror_driver_activate(wfi);
#endif
}
else
{
wf_mirror_driver_activate(wfi);
}
wfi->peers[wfi->peerCount++] = ((rdpContext*) context)->peer;
@ -223,12 +217,10 @@ void wf_info_peer_unregister(wfInfo* wfi, wfPeerContext* context)
printf("Unregistering Peer: %d\n", wfi->peerCount);
if(wfi->peerCount == 0)
{
#ifdef WITH_WIN8
if (wfi->peerCount == 0)
wf_dxgi_cleanup(wfi);
#endif
}
wf_info_unlock(wfi);
}
@ -237,20 +229,12 @@ void wf_info_peer_unregister(wfInfo* wfi, wfPeerContext* context)
BOOL wf_info_have_updates(wfInfo* wfi)
{
#ifdef WITH_WIN8
if(wfi->framesWaiting == 0)
return FALSE;
#else
if (wfi->nextUpdate == wfi->lastUpdate)
return FALSE;
#endif
return TRUE;
}
@ -259,23 +243,18 @@ void wf_info_update_changes(wfInfo* wfi)
#ifdef WITH_WIN8
wf_dxgi_nextFrame(wfi, wfi->framesPerSecond / 1000);
#else
GETCHANGESBUF* buf;
buf = (GETCHANGESBUF*) wfi->changeBuffer;
wfi->nextUpdate = buf->buffer->counter;
#endif
}
void wf_info_find_invalid_region(wfInfo* wfi)
{
#ifdef WITH_WIN8
wf_dxgi_getInvalidRegion(&wfi->invalid);
#else
int i;
GETCHANGESBUF* buf;
@ -285,11 +264,10 @@ void wf_info_find_invalid_region(wfInfo* wfi)
{
UnionRect(&wfi->invalid, &wfi->invalid, &buf->buffer->pointrect[i].rect);
}
#endif
if (wfi->invalid.left < 0)
wfi->invalid.left = 0;
wfi->invalid.left = 0;
if (wfi->invalid.top < 0)
wfi->invalid.top = 0;
@ -299,7 +277,6 @@ void wf_info_find_invalid_region(wfInfo* wfi)
if (wfi->invalid.bottom >= wfi->height)
wfi->invalid.bottom = wfi->height - 1;
}
void wf_info_clear_invalid_region(wfInfo* wfi)
@ -324,22 +301,19 @@ void wf_info_getScreenData(wfInfo* wfi, long* width, long* height, uint8** pBits
*height = (wfi->invalid.bottom - wfi->invalid.top);
#ifdef WITH_WIN8
wf_dxgi_getPixelData(wfi, pBits, pitch, &wfi->invalid);
#else
{
long offset;
GETCHANGESBUF* changes;
changes = (GETCHANGESBUF*) wfi->changeBuffer;
long offset;
GETCHANGESBUF* changes;
changes = (GETCHANGESBUF*) wfi->changeBuffer;
*width += 1;
*height += 1;
*width += 1;
*height += 1;
offset = (4 * wfi->invalid.left) + (wfi->invalid.top * wfi->width * 4);
*pBits = ((uint8*) (changes->Userbuffer)) + offset;
*pitch = wfi->width * 4;
offset = (4 * wfi->invalid.left) + (wfi->invalid.top * wfi->width * 4);
*pBits = ((uint8*) (changes->Userbuffer)) + offset;
*pitch = wfi->width * 4;
}
#endif
}
}

View File

@ -138,6 +138,8 @@ DWORD WINAPI wf_peer_socket_listener(LPVOID lpParam)
ZeroMemory(rfds, sizeof(rfds));
context = (wfPeerContext*) client->context;
printf("PeerSocketListener\n");
while (1)
{
rcount = 0;
@ -220,11 +222,15 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
wfi = context->info;
context->socketEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
printf("socketEvent created\n");
context->socketSemaphore = CreateSemaphore(NULL, 0, 1, NULL);
context->socketThread = CreateThread(NULL, 0, wf_peer_socket_listener, client, 0, NULL);
printf("We've got a client %s\n", client->local ? "(local)" : client->hostname);
printf("Setting Handles\n");
nCount = 0;
handles[nCount++] = context->updateEvent;
handles[nCount++] = context->socketEvent;
@ -233,6 +239,12 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
{
status = WaitForMultipleObjects(nCount, handles, FALSE, INFINITE);
if ((status == WAIT_FAILED) || (status == WAIT_TIMEOUT))
{
printf("WaitForMultipleObjects failed\n");
break;
}
if (WaitForSingleObject(context->updateEvent, 0) == 0)
{
if (client->activated)

View File

@ -29,4 +29,22 @@
#include <winpr/string.h>
#include <winpr/memory.h>
/* Data Alignment */
#ifndef _WIN32
WINPR_API void* _aligned_malloc(size_t size, size_t alignment);
WINPR_API void* _aligned_realloc(void* memblock, size_t size, size_t alignment);
WINPR_API void* _aligned_recalloc(void* memblock, size_t num, size_t size, size_t alignment);
WINPR_API void* _aligned_offset_malloc(size_t size, size_t alignment, size_t offset);
WINPR_API void* _aligned_offset_realloc(void* memblock, size_t size, size_t alignment, size_t offset);
WINPR_API void* _aligned_offset_recalloc(void* memblock, size_t num, size_t size, size_t alignment, size_t offset);
WINPR_API size_t _aligned_msize(void* memblock, size_t alignment, size_t offset);
WINPR_API void _aligned_free(void* memblock);
#endif
#endif /* WINPR_CRT_H */

View File

@ -26,6 +26,37 @@
#ifndef _WIN32
typedef struct _LIST_ENTRY LIST_ENTRY;
typedef struct _LIST_ENTRY* PLIST_ENTRY;
struct _LIST_ENTRY
{
PLIST_ENTRY Flink;
PLIST_ENTRY Blink;
};
typedef struct _SINGLE_LIST_ENTRY SINGLE_LIST_ENTRY;
typedef struct _SINGLE_LIST_ENTRY* PSINGLE_LIST_ENTRY;
struct _SINGLE_LIST_ENTRY
{
PSINGLE_LIST_ENTRY Next;
};
typedef struct LIST_ENTRY32
{
DWORD Flink;
DWORD Blink;
} LIST_ENTRY32;
typedef LIST_ENTRY32 *PLIST_ENTRY32;
typedef struct LIST_ENTRY64
{
ULONGLONG Flink;
ULONGLONG Blink;
} LIST_ENTRY64;
typedef LIST_ENTRY64 *PLIST_ENTRY64;
#ifdef _AMD64_
typedef struct _SLIST_ENTRY *PSLIST_ENTRY;

View File

@ -37,5 +37,11 @@
#endif
#endif /* DECLSPEC_ALIGN */
#ifdef _AMD64_
#define MEMORY_ALLOCATION_ALIGNMENT 16
#else
#define MEMORY_ALLOCATION_ALIGNMENT 8
#endif
#endif /* WINPR_SPEC_H */

View File

@ -87,8 +87,6 @@ WINPR_API BOOL ResetEvent(HANDLE hEvent);
/* One-Time Initialization */
#define CALLBACK
typedef union _RTL_RUN_ONCE
{
PVOID Ptr;

View File

@ -137,6 +137,8 @@ WINPR_API DWORD GetCurrentProcessorNumber(VOID);
/* Thread-Local Storage */
#define TLS_OUT_OF_INDEXES ((DWORD) 0xFFFFFFFF)
WINPR_API DWORD TlsAlloc(VOID);
WINPR_API LPVOID TlsGetValue(DWORD dwTlsIndex);
WINPR_API BOOL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue);

View File

@ -0,0 +1,33 @@
/**
* WinPR: Windows Portable Runtime
* Time Zone
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef WINPR_TIMEZONE_H
#define WINPR_TIMEZONE_H
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
#ifndef _WIN32
#endif
#endif /* WINPR_TIMEZONE_H */

View File

@ -0,0 +1,657 @@
/**
* WinPR: Windows Portable Runtime
* Windows HTTP (WinHTTP)
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef WINPR_WINHTTP_H
#define WINPR_WINHTTP_H
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
#include <winpr/winsock.h>
#ifdef _WIN32
#include <winhttp.h>
#else
typedef LPVOID HINTERNET;
typedef HINTERNET* LPHINTERNET;
typedef WORD INTERNET_PORT;
typedef INTERNET_PORT* LPINTERNET_PORT;
#define INTERNET_DEFAULT_PORT 0
#define INTERNET_DEFAULT_HTTP_PORT 80
#define INTERNET_DEFAULT_HTTPS_PORT 443
#define WINHTTP_FLAG_ASYNC 0x10000000
#define WINHTTP_FLAG_SECURE 0x00800000
#define WINHTTP_FLAG_ESCAPE_PERCENT 0x00000004
#define WINHTTP_FLAG_NULL_CODEPAGE 0x00000008
#define WINHTTP_FLAG_BYPASS_PROXY_CACHE 0x00000100
#define WINHTTP_FLAG_REFRESH WINHTTP_FLAG_BYPASS_PROXY_CACHE
#define WINHTTP_FLAG_ESCAPE_DISABLE 0x00000040
#define WINHTTP_FLAG_ESCAPE_DISABLE_QUERY 0x00000080
#define SECURITY_FLAG_IGNORE_UNKNOWN_CA 0x00000100
#define SECURITY_FLAG_IGNORE_CERT_DATE_INVALID 0x00002000
#define SECURITY_FLAG_IGNORE_CERT_CN_INVALID 0x00001000
#define SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE 0x00000200
typedef struct
{
DWORD_PTR dwResult;
DWORD dwError;
}
WINHTTP_ASYNC_RESULT, *LPWINHTTP_ASYNC_RESULT;
typedef struct
{
DWORD dwMajorVersion;
DWORD dwMinorVersion;
}
HTTP_VERSION_INFO, *LPHTTP_VERSION_INFO;
typedef int INTERNET_SCHEME, *LPINTERNET_SCHEME;
#define INTERNET_SCHEME_HTTP (1)
#define INTERNET_SCHEME_HTTPS (2)
typedef struct
{
DWORD dwStructSize;
LPWSTR lpszScheme;
DWORD dwSchemeLength;
INTERNET_SCHEME nScheme;
LPWSTR lpszHostName;
DWORD dwHostNameLength;
INTERNET_PORT nPort;
LPWSTR lpszUserName;
DWORD dwUserNameLength;
LPWSTR lpszPassword;
DWORD dwPasswordLength;
LPWSTR lpszUrlPath;
DWORD dwUrlPathLength;
LPWSTR lpszExtraInfo;
DWORD dwExtraInfoLength;
}
URL_COMPONENTS, *LPURL_COMPONENTS;
typedef URL_COMPONENTS URL_COMPONENTSW;
typedef LPURL_COMPONENTS LPURL_COMPONENTSW;
typedef struct
{
DWORD dwAccessType;
LPWSTR lpszProxy;
LPWSTR lpszProxyBypass;
}
WINHTTP_PROXY_INFO, *LPWINHTTP_PROXY_INFO;
typedef WINHTTP_PROXY_INFO WINHTTP_PROXY_INFOW;
typedef LPWINHTTP_PROXY_INFO LPWINHTTP_PROXY_INFOW;
typedef struct
{
DWORD dwFlags;
DWORD dwAutoDetectFlags;
LPCWSTR lpszAutoConfigUrl;
LPVOID lpvReserved;
DWORD dwReserved;
BOOL fAutoLogonIfChallenged;
} WINHTTP_AUTOPROXY_OPTIONS;
#define WINHTTP_AUTOPROXY_AUTO_DETECT 0x00000001
#define WINHTTP_AUTOPROXY_CONFIG_URL 0x00000002
#define WINHTTP_AUTOPROXY_HOST_KEEPCASE 0x00000004
#define WINHTTP_AUTOPROXY_HOST_LOWERCASE 0x00000008
#define WINHTTP_AUTOPROXY_RUN_INPROCESS 0x00010000
#define WINHTTP_AUTOPROXY_RUN_OUTPROCESS_ONLY 0x00020000
#define WINHTTP_AUTO_DETECT_TYPE_DHCP 0x00000001
#define WINHTTP_AUTO_DETECT_TYPE_DNS_A 0x00000002
typedef struct
{
FILETIME ftExpiry;
FILETIME ftStart;
LPWSTR lpszSubjectInfo;
LPWSTR lpszIssuerInfo;
LPWSTR lpszProtocolName;
LPWSTR lpszSignatureAlgName;
LPWSTR lpszEncryptionAlgName;
DWORD dwKeySize;
} WINHTTP_CERTIFICATE_INFO;
typedef struct
{
DWORD cbSize;
SOCKADDR_STORAGE LocalAddress;
SOCKADDR_STORAGE RemoteAddress;
} WINHTTP_CONNECTION_INFO;
#define WINHTTP_TIME_FORMAT_BUFSIZE 62
#define ICU_NO_ENCODE 0x20000000
#define ICU_DECODE 0x10000000
#define ICU_NO_META 0x08000000
#define ICU_ENCODE_SPACES_ONLY 0x04000000
#define ICU_BROWSER_MODE 0x02000000
#define ICU_ENCODE_PERCENT 0x00001000
#define ICU_ESCAPE 0x80000000
#define ICU_ESCAPE_AUTHORITY 0x00002000
#define ICU_REJECT_USERPWD 0x00004000
#define WINHTTP_ACCESS_TYPE_DEFAULT_PROXY 0
#define WINHTTP_ACCESS_TYPE_NO_PROXY 1
#define WINHTTP_ACCESS_TYPE_NAMED_PROXY 3
#define WINHTTP_NO_PROXY_NAME NULL
#define WINHTTP_NO_PROXY_BYPASS NULL
#define WINHTTP_NO_CLIENT_CERT_CONTEXT NULL
#define WINHTTP_FIRST_OPTION WINHTTP_OPTION_CALLBACK
#define WINHTTP_OPTION_CALLBACK 1
#define WINHTTP_OPTION_RESOLVE_TIMEOUT 2
#define WINHTTP_OPTION_CONNECT_TIMEOUT 3
#define WINHTTP_OPTION_CONNECT_RETRIES 4
#define WINHTTP_OPTION_SEND_TIMEOUT 5
#define WINHTTP_OPTION_RECEIVE_TIMEOUT 6
#define WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT 7
#define WINHTTP_OPTION_HANDLE_TYPE 9
#define WINHTTP_OPTION_READ_BUFFER_SIZE 12
#define WINHTTP_OPTION_WRITE_BUFFER_SIZE 13
#define WINHTTP_OPTION_PARENT_HANDLE 21
#define WINHTTP_OPTION_EXTENDED_ERROR 24
#define WINHTTP_OPTION_SECURITY_FLAGS 31
#define WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT 32
#define WINHTTP_OPTION_URL 34
#define WINHTTP_OPTION_SECURITY_KEY_BITNESS 36
#define WINHTTP_OPTION_PROXY 38
#define WINHTTP_OPTION_USER_AGENT 41
#define WINHTTP_OPTION_CONTEXT_VALUE 45
#define WINHTTP_OPTION_CLIENT_CERT_CONTEXT 47
#define WINHTTP_OPTION_REQUEST_PRIORITY 58
#define WINHTTP_OPTION_HTTP_VERSION 59
#define WINHTTP_OPTION_DISABLE_FEATURE 63
#define WINHTTP_OPTION_CODEPAGE 68
#define WINHTTP_OPTION_MAX_CONNS_PER_SERVER 73
#define WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER 74
#define WINHTTP_OPTION_AUTOLOGON_POLICY 77
#define WINHTTP_OPTION_SERVER_CERT_CONTEXT 78
#define WINHTTP_OPTION_ENABLE_FEATURE 79
#define WINHTTP_OPTION_WORKER_THREAD_COUNT 80
#define WINHTTP_OPTION_PASSPORT_COBRANDING_TEXT 81
#define WINHTTP_OPTION_PASSPORT_COBRANDING_URL 82
#define WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH 83
#define WINHTTP_OPTION_SECURE_PROTOCOLS 84
#define WINHTTP_OPTION_ENABLETRACING 85
#define WINHTTP_OPTION_PASSPORT_SIGN_OUT 86
#define WINHTTP_OPTION_PASSPORT_RETURN_URL 87
#define WINHTTP_OPTION_REDIRECT_POLICY 88
#define WINHTTP_OPTION_MAX_HTTP_AUTOMATIC_REDIRECTS 89
#define WINHTTP_OPTION_MAX_HTTP_STATUS_CONTINUE 90
#define WINHTTP_OPTION_MAX_RESPONSE_HEADER_SIZE 91
#define WINHTTP_OPTION_MAX_RESPONSE_DRAIN_SIZE 92
#define WINHTTP_OPTION_CONNECTION_INFO 93
#define WINHTTP_OPTION_CLIENT_CERT_ISSUER_LIST 94
#define WINHTTP_OPTION_SPN 96
#define WINHTTP_OPTION_GLOBAL_PROXY_CREDS 97
#define WINHTTP_OPTION_GLOBAL_SERVER_CREDS 98
#define WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT 99
#define WINHTTP_OPTION_REJECT_USERPWD_IN_URL 100
#define WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS 101
#define WINHTTP_OPTION_RECEIVE_PROXY_CONNECT_RESPONSE 103
#define WINHTTP_OPTION_IS_PROXY_CONNECT_RESPONSE 104
#define WINHTTP_OPTION_SERVER_SPN_USED 106
#define WINHTTP_OPTION_PROXY_SPN_USED 107
#define WINHTTP_OPTION_SERVER_CBT 108
#define WINHTTP_LAST_OPTION WINHTTP_OPTION_SERVER_CBT
#define WINHTTP_OPTION_USERNAME 0x1000
#define WINHTTP_OPTION_PASSWORD 0x1001
#define WINHTTP_OPTION_PROXY_USERNAME 0x1002
#define WINHTTP_OPTION_PROXY_PASSWORD 0x1003
#define WINHTTP_CONNS_PER_SERVER_UNLIMITED 0xFFFFFFFF
#define WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM 0
#define WINHTTP_AUTOLOGON_SECURITY_LEVEL_LOW 1
#define WINHTTP_AUTOLOGON_SECURITY_LEVEL_HIGH 2
#define WINHTTP_AUTOLOGON_SECURITY_LEVEL_DEFAULT WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM
#define WINHTTP_OPTION_REDIRECT_POLICY_NEVER 0
#define WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP 1
#define WINHTTP_OPTION_REDIRECT_POLICY_ALWAYS 2
#define WINHTTP_OPTION_REDIRECT_POLICY_LAST WINHTTP_OPTION_REDIRECT_POLICY_ALWAYS
#define WINHTTP_OPTION_REDIRECT_POLICY_DEFAULT WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP
#define WINHTTP_DISABLE_PASSPORT_AUTH 0x00000000
#define WINHTTP_ENABLE_PASSPORT_AUTH 0x10000000
#define WINHTTP_DISABLE_PASSPORT_KEYRING 0x20000000
#define WINHTTP_ENABLE_PASSPORT_KEYRING 0x40000000
#define WINHTTP_DISABLE_COOKIES 0x00000001
#define WINHTTP_DISABLE_REDIRECTS 0x00000002
#define WINHTTP_DISABLE_AUTHENTICATION 0x00000004
#define WINHTTP_DISABLE_KEEP_ALIVE 0x00000008
#define WINHTTP_ENABLE_SSL_REVOCATION 0x00000001
#define WINHTTP_ENABLE_SSL_REVERT_IMPERSONATION 0x00000002
#define WINHTTP_DISABLE_SPN_SERVER_PORT 0x00000000
#define WINHTTP_ENABLE_SPN_SERVER_PORT 0x00000001
#define WINHTTP_OPTION_SPN_MASK WINHTTP_ENABLE_SPN_SERVER_PORT
typedef struct tagWINHTTP_CREDS
{
LPSTR lpszUserName;
LPSTR lpszPassword;
LPSTR lpszRealm;
DWORD dwAuthScheme;
LPSTR lpszHostName;
DWORD dwPort;
} WINHTTP_CREDS, *PWINHTTP_CREDS;
typedef struct tagWINHTTP_CREDS_EX
{
LPSTR lpszUserName;
LPSTR lpszPassword;
LPSTR lpszRealm;
DWORD dwAuthScheme;
LPSTR lpszHostName;
DWORD dwPort;
LPSTR lpszUrl;
} WINHTTP_CREDS_EX, *PWINHTTP_CREDS_EX;
#define WINHTTP_HANDLE_TYPE_SESSION 1
#define WINHTTP_HANDLE_TYPE_CONNECT 2
#define WINHTTP_HANDLE_TYPE_REQUEST 3
#define WINHTTP_AUTH_SCHEME_BASIC 0x00000001
#define WINHTTP_AUTH_SCHEME_NTLM 0x00000002
#define WINHTTP_AUTH_SCHEME_PASSPORT 0x00000004
#define WINHTTP_AUTH_SCHEME_DIGEST 0x00000008
#define WINHTTP_AUTH_SCHEME_NEGOTIATE 0x00000010
#define WINHTTP_AUTH_TARGET_SERVER 0x00000000
#define WINHTTP_AUTH_TARGET_PROXY 0x00000001
#define SECURITY_FLAG_SECURE 0x00000001
#define SECURITY_FLAG_STRENGTH_WEAK 0x10000000
#define SECURITY_FLAG_STRENGTH_MEDIUM 0x40000000
#define SECURITY_FLAG_STRENGTH_STRONG 0x20000000
#define WINHTTP_CALLBACK_STATUS_FLAG_CERT_REV_FAILED 0x00000001
#define WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CERT 0x00000002
#define WINHTTP_CALLBACK_STATUS_FLAG_CERT_REVOKED 0x00000004
#define WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CA 0x00000008
#define WINHTTP_CALLBACK_STATUS_FLAG_CERT_CN_INVALID 0x00000010
#define WINHTTP_CALLBACK_STATUS_FLAG_CERT_DATE_INVALID 0x00000020
#define WINHTTP_CALLBACK_STATUS_FLAG_CERT_WRONG_USAGE 0x00000040
#define WINHTTP_CALLBACK_STATUS_FLAG_SECURITY_CHANNEL_ERROR 0x80000000
#define WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 0x00000008
#define WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 0x00000020
#define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 0x00000080
#define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 0x00000200
#define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 0x00000800
#define WINHTTP_FLAG_SECURE_PROTOCOL_ALL (WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 | \
WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 | \
WINHTTP_FLAG_SECURE_PROTOCOL_TLS1)
typedef VOID (CALLBACK * WINHTTP_STATUS_CALLBACK)(HINTERNET hInternet, DWORD_PTR dwContext, DWORD dwInternetStatus,
LPVOID lpvStatusInformation, DWORD dwStatusInformationLength);
typedef WINHTTP_STATUS_CALLBACK * LPWINHTTP_STATUS_CALLBACK;
#define WINHTTP_CALLBACK_STATUS_RESOLVING_NAME 0x00000001
#define WINHTTP_CALLBACK_STATUS_NAME_RESOLVED 0x00000002
#define WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER 0x00000004
#define WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER 0x00000008
#define WINHTTP_CALLBACK_STATUS_SENDING_REQUEST 0x00000010
#define WINHTTP_CALLBACK_STATUS_REQUEST_SENT 0x00000020
#define WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE 0x00000040
#define WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED 0x00000080
#define WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION 0x00000100
#define WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED 0x00000200
#define WINHTTP_CALLBACK_STATUS_HANDLE_CREATED 0x00000400
#define WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING 0x00000800
#define WINHTTP_CALLBACK_STATUS_DETECTING_PROXY 0x00001000
#define WINHTTP_CALLBACK_STATUS_REDIRECT 0x00004000
#define WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE 0x00008000
#define WINHTTP_CALLBACK_STATUS_SECURE_FAILURE 0x00010000
#define WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE 0x00020000
#define WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE 0x00040000
#define WINHTTP_CALLBACK_STATUS_READ_COMPLETE 0x00080000
#define WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE 0x00100000
#define WINHTTP_CALLBACK_STATUS_REQUEST_ERROR 0x00200000
#define WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE 0x00400000
#define API_RECEIVE_RESPONSE (1)
#define API_QUERY_DATA_AVAILABLE (2)
#define API_READ_DATA (3)
#define API_WRITE_DATA (4)
#define API_SEND_REQUEST (5)
#define WINHTTP_CALLBACK_FLAG_RESOLVE_NAME (WINHTTP_CALLBACK_STATUS_RESOLVING_NAME | WINHTTP_CALLBACK_STATUS_NAME_RESOLVED)
#define WINHTTP_CALLBACK_FLAG_CONNECT_TO_SERVER (WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER | WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER)
#define WINHTTP_CALLBACK_FLAG_SEND_REQUEST (WINHTTP_CALLBACK_STATUS_SENDING_REQUEST | WINHTTP_CALLBACK_STATUS_REQUEST_SENT)
#define WINHTTP_CALLBACK_FLAG_RECEIVE_RESPONSE (WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE | WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED)
#define WINHTTP_CALLBACK_FLAG_CLOSE_CONNECTION (WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION | WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED)
#define WINHTTP_CALLBACK_FLAG_HANDLES (WINHTTP_CALLBACK_STATUS_HANDLE_CREATED | WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING)
#define WINHTTP_CALLBACK_FLAG_DETECTING_PROXY WINHTTP_CALLBACK_STATUS_DETECTING_PROXY
#define WINHTTP_CALLBACK_FLAG_REDIRECT WINHTTP_CALLBACK_STATUS_REDIRECT
#define WINHTTP_CALLBACK_FLAG_INTERMEDIATE_RESPONSE WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE
#define WINHTTP_CALLBACK_FLAG_SECURE_FAILURE WINHTTP_CALLBACK_STATUS_SECURE_FAILURE
#define WINHTTP_CALLBACK_FLAG_SENDREQUEST_COMPLETE WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE
#define WINHTTP_CALLBACK_FLAG_HEADERS_AVAILABLE WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE
#define WINHTTP_CALLBACK_FLAG_DATA_AVAILABLE WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE
#define WINHTTP_CALLBACK_FLAG_READ_COMPLETE WINHTTP_CALLBACK_STATUS_READ_COMPLETE
#define WINHTTP_CALLBACK_FLAG_WRITE_COMPLETE WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE
#define WINHTTP_CALLBACK_FLAG_REQUEST_ERROR WINHTTP_CALLBACK_STATUS_REQUEST_ERROR
#define WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS (WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE \
| WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE \
| WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE \
| WINHTTP_CALLBACK_STATUS_READ_COMPLETE \
| WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE \
| WINHTTP_CALLBACK_STATUS_REQUEST_ERROR)
#define WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS 0xFFFFFFFF
#define WINHTTP_INVALID_STATUS_CALLBACK ((WINHTTP_STATUS_CALLBACK) (-1L))
#define WINHTTP_QUERY_MIME_VERSION 0
#define WINHTTP_QUERY_CONTENT_TYPE 1
#define WINHTTP_QUERY_CONTENT_TRANSFER_ENCODING 2
#define WINHTTP_QUERY_CONTENT_ID 3
#define WINHTTP_QUERY_CONTENT_DESCRIPTION 4
#define WINHTTP_QUERY_CONTENT_LENGTH 5
#define WINHTTP_QUERY_CONTENT_LANGUAGE 6
#define WINHTTP_QUERY_ALLOW 7
#define WINHTTP_QUERY_PUBLIC 8
#define WINHTTP_QUERY_DATE 9
#define WINHTTP_QUERY_EXPIRES 10
#define WINHTTP_QUERY_LAST_MODIFIED 11
#define WINHTTP_QUERY_MESSAGE_ID 12
#define WINHTTP_QUERY_URI 13
#define WINHTTP_QUERY_DERIVED_FROM 14
#define WINHTTP_QUERY_COST 15
#define WINHTTP_QUERY_LINK 16
#define WINHTTP_QUERY_PRAGMA 17
#define WINHTTP_QUERY_VERSION 18
#define WINHTTP_QUERY_STATUS_CODE 19
#define WINHTTP_QUERY_STATUS_TEXT 20
#define WINHTTP_QUERY_RAW_HEADERS 21
#define WINHTTP_QUERY_RAW_HEADERS_CRLF 22
#define WINHTTP_QUERY_CONNECTION 23
#define WINHTTP_QUERY_ACCEPT 24
#define WINHTTP_QUERY_ACCEPT_CHARSET 25
#define WINHTTP_QUERY_ACCEPT_ENCODING 26
#define WINHTTP_QUERY_ACCEPT_LANGUAGE 27
#define WINHTTP_QUERY_AUTHORIZATION 28
#define WINHTTP_QUERY_CONTENT_ENCODING 29
#define WINHTTP_QUERY_FORWARDED 30
#define WINHTTP_QUERY_FROM 31
#define WINHTTP_QUERY_IF_MODIFIED_SINCE 32
#define WINHTTP_QUERY_LOCATION 33
#define WINHTTP_QUERY_ORIG_URI 34
#define WINHTTP_QUERY_REFERER 35
#define WINHTTP_QUERY_RETRY_AFTER 36
#define WINHTTP_QUERY_SERVER 37
#define WINHTTP_QUERY_TITLE 38
#define WINHTTP_QUERY_USER_AGENT 39
#define WINHTTP_QUERY_WWW_AUTHENTICATE 40
#define WINHTTP_QUERY_PROXY_AUTHENTICATE 41
#define WINHTTP_QUERY_ACCEPT_RANGES 42
#define WINHTTP_QUERY_SET_COOKIE 43
#define WINHTTP_QUERY_COOKIE 44
#define WINHTTP_QUERY_REQUEST_METHOD 45
#define WINHTTP_QUERY_REFRESH 46
#define WINHTTP_QUERY_CONTENT_DISPOSITION 47
#define WINHTTP_QUERY_AGE 48
#define WINHTTP_QUERY_CACHE_CONTROL 49
#define WINHTTP_QUERY_CONTENT_BASE 50
#define WINHTTP_QUERY_CONTENT_LOCATION 51
#define WINHTTP_QUERY_CONTENT_MD5 52
#define WINHTTP_QUERY_CONTENT_RANGE 53
#define WINHTTP_QUERY_ETAG 54
#define WINHTTP_QUERY_HOST 55
#define WINHTTP_QUERY_IF_MATCH 56
#define WINHTTP_QUERY_IF_NONE_MATCH 57
#define WINHTTP_QUERY_IF_RANGE 58
#define WINHTTP_QUERY_IF_UNMODIFIED_SINCE 59
#define WINHTTP_QUERY_MAX_FORWARDS 60
#define WINHTTP_QUERY_PROXY_AUTHORIZATION 61
#define WINHTTP_QUERY_RANGE 62
#define WINHTTP_QUERY_TRANSFER_ENCODING 63
#define WINHTTP_QUERY_UPGRADE 64
#define WINHTTP_QUERY_VARY 65
#define WINHTTP_QUERY_VIA 66
#define WINHTTP_QUERY_WARNING 67
#define WINHTTP_QUERY_EXPECT 68
#define WINHTTP_QUERY_PROXY_CONNECTION 69
#define WINHTTP_QUERY_UNLESS_MODIFIED_SINCE 70
#define WINHTTP_QUERY_PROXY_SUPPORT 75
#define WINHTTP_QUERY_AUTHENTICATION_INFO 76
#define WINHTTP_QUERY_PASSPORT_URLS 77
#define WINHTTP_QUERY_PASSPORT_CONFIG 78
#define WINHTTP_QUERY_MAX 78
#define WINHTTP_QUERY_CUSTOM 65535
#define WINHTTP_QUERY_FLAG_REQUEST_HEADERS 0x80000000
#define WINHTTP_QUERY_FLAG_SYSTEMTIME 0x40000000
#define WINHTTP_QUERY_FLAG_NUMBER 0x20000000
#define HTTP_STATUS_CONTINUE 100
#define HTTP_STATUS_SWITCH_PROTOCOLS 101
#define HTTP_STATUS_OK 200
#define HTTP_STATUS_CREATED 201
#define HTTP_STATUS_ACCEPTED 202
#define HTTP_STATUS_PARTIAL 203
#define HTTP_STATUS_NO_CONTENT 204
#define HTTP_STATUS_RESET_CONTENT 205
#define HTTP_STATUS_PARTIAL_CONTENT 206
#define HTTP_STATUS_WEBDAV_MULTI_STATUS 207
#define HTTP_STATUS_AMBIGUOUS 300
#define HTTP_STATUS_MOVED 301
#define HTTP_STATUS_REDIRECT 302
#define HTTP_STATUS_REDIRECT_METHOD 303
#define HTTP_STATUS_NOT_MODIFIED 304
#define HTTP_STATUS_USE_PROXY 305
#define HTTP_STATUS_REDIRECT_KEEP_VERB 307
#define HTTP_STATUS_BAD_REQUEST 400
#define HTTP_STATUS_DENIED 401
#define HTTP_STATUS_PAYMENT_REQ 402
#define HTTP_STATUS_FORBIDDEN 403
#define HTTP_STATUS_NOT_FOUND 404
#define HTTP_STATUS_BAD_METHOD 405
#define HTTP_STATUS_NONE_ACCEPTABLE 406
#define HTTP_STATUS_PROXY_AUTH_REQ 407
#define HTTP_STATUS_REQUEST_TIMEOUT 408
#define HTTP_STATUS_CONFLICT 409
#define HTTP_STATUS_GONE 410
#define HTTP_STATUS_LENGTH_REQUIRED 411
#define HTTP_STATUS_PRECOND_FAILED 412
#define HTTP_STATUS_REQUEST_TOO_LARGE 413
#define HTTP_STATUS_URI_TOO_LONG 414
#define HTTP_STATUS_UNSUPPORTED_MEDIA 415
#define HTTP_STATUS_RETRY_WITH 449
#define HTTP_STATUS_SERVER_ERROR 500
#define HTTP_STATUS_NOT_SUPPORTED 501
#define HTTP_STATUS_BAD_GATEWAY 502
#define HTTP_STATUS_SERVICE_UNAVAIL 503
#define HTTP_STATUS_GATEWAY_TIMEOUT 504
#define HTTP_STATUS_VERSION_NOT_SUP 505
#define HTTP_STATUS_FIRST HTTP_STATUS_CONTINUE
#define HTTP_STATUS_LAST HTTP_STATUS_VERSION_NOT_SUP
#define WINHTTP_NO_REFERER NULL
#define WINHTTP_DEFAULT_ACCEPT_TYPES NULL
#define WINHTTP_ADDREQ_INDEX_MASK 0x0000FFFF
#define WINHTTP_ADDREQ_FLAGS_MASK 0xFFFF0000
#define WINHTTP_ADDREQ_FLAG_ADD_IF_NEW 0x10000000
#define WINHTTP_ADDREQ_FLAG_ADD 0x20000000
#define WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA 0x40000000
#define WINHTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON 0x01000000
#define WINHTTP_ADDREQ_FLAG_COALESCE WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA
#define WINHTTP_ADDREQ_FLAG_REPLACE 0x80000000
#define WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH 0
#define WINHTTP_NO_ADDITIONAL_HEADERS NULL
#define WINHTTP_NO_REQUEST_DATA NULL
#define WINHTTP_HEADER_NAME_BY_INDEX NULL
#define WINHTTP_NO_OUTPUT_BUFFER NULL
#define WINHTTP_NO_HEADER_INDEX NULL
typedef struct
{
BOOL fAutoDetect;
LPWSTR lpszAutoConfigUrl;
LPWSTR lpszProxy;
LPWSTR lpszProxyBypass;
} WINHTTP_CURRENT_USER_IE_PROXY_CONFIG;
#define WINHTTP_ERROR_BASE 12000
#define ERROR_WINHTTP_OUT_OF_HANDLES (WINHTTP_ERROR_BASE + 1)
#define ERROR_WINHTTP_TIMEOUT (WINHTTP_ERROR_BASE + 2)
#define ERROR_WINHTTP_INTERNAL_ERROR (WINHTTP_ERROR_BASE + 4)
#define ERROR_WINHTTP_INVALID_URL (WINHTTP_ERROR_BASE + 5)
#define ERROR_WINHTTP_UNRECOGNIZED_SCHEME (WINHTTP_ERROR_BASE + 6)
#define ERROR_WINHTTP_NAME_NOT_RESOLVED (WINHTTP_ERROR_BASE + 7)
#define ERROR_WINHTTP_INVALID_OPTION (WINHTTP_ERROR_BASE + 9)
#define ERROR_WINHTTP_OPTION_NOT_SETTABLE (WINHTTP_ERROR_BASE + 11)
#define ERROR_WINHTTP_SHUTDOWN (WINHTTP_ERROR_BASE + 12)
#define ERROR_WINHTTP_LOGIN_FAILURE (WINHTTP_ERROR_BASE + 15)
#define ERROR_WINHTTP_OPERATION_CANCELLED (WINHTTP_ERROR_BASE + 17)
#define ERROR_WINHTTP_INCORRECT_HANDLE_TYPE (WINHTTP_ERROR_BASE + 18)
#define ERROR_WINHTTP_INCORRECT_HANDLE_STATE (WINHTTP_ERROR_BASE + 19)
#define ERROR_WINHTTP_CANNOT_CONNECT (WINHTTP_ERROR_BASE + 29)
#define ERROR_WINHTTP_CONNECTION_ERROR (WINHTTP_ERROR_BASE + 30)
#define ERROR_WINHTTP_RESEND_REQUEST (WINHTTP_ERROR_BASE + 32)
#define ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED (WINHTTP_ERROR_BASE + 44)
#define ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN (WINHTTP_ERROR_BASE + 100)
#define ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND (WINHTTP_ERROR_BASE + 101)
#define ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND (WINHTTP_ERROR_BASE + 102)
#define ERROR_WINHTTP_CANNOT_CALL_AFTER_OPEN (WINHTTP_ERROR_BASE + 103)
#define ERROR_WINHTTP_HEADER_NOT_FOUND (WINHTTP_ERROR_BASE + 150)
#define ERROR_WINHTTP_INVALID_SERVER_RESPONSE (WINHTTP_ERROR_BASE + 152)
#define ERROR_WINHTTP_INVALID_HEADER (WINHTTP_ERROR_BASE + 153)
#define ERROR_WINHTTP_INVALID_QUERY_REQUEST (WINHTTP_ERROR_BASE + 154)
#define ERROR_WINHTTP_HEADER_ALREADY_EXISTS (WINHTTP_ERROR_BASE + 155)
#define ERROR_WINHTTP_REDIRECT_FAILED (WINHTTP_ERROR_BASE + 156)
#define ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR (WINHTTP_ERROR_BASE + 178)
#define ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT (WINHTTP_ERROR_BASE + 166)
#define ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT (WINHTTP_ERROR_BASE + 167)
#define ERROR_WINHTTP_NOT_INITIALIZED (WINHTTP_ERROR_BASE + 172)
#define ERROR_WINHTTP_SECURE_FAILURE (WINHTTP_ERROR_BASE + 175)
#define ERROR_WINHTTP_SECURE_CERT_DATE_INVALID (WINHTTP_ERROR_BASE + 37)
#define ERROR_WINHTTP_SECURE_CERT_CN_INVALID (WINHTTP_ERROR_BASE + 38)
#define ERROR_WINHTTP_SECURE_INVALID_CA (WINHTTP_ERROR_BASE + 45)
#define ERROR_WINHTTP_SECURE_CERT_REV_FAILED (WINHTTP_ERROR_BASE + 57)
#define ERROR_WINHTTP_SECURE_CHANNEL_ERROR (WINHTTP_ERROR_BASE + 157)
#define ERROR_WINHTTP_SECURE_INVALID_CERT (WINHTTP_ERROR_BASE + 169)
#define ERROR_WINHTTP_SECURE_CERT_REVOKED (WINHTTP_ERROR_BASE + 170)
#define ERROR_WINHTTP_SECURE_CERT_WRONG_USAGE (WINHTTP_ERROR_BASE + 179)
#define ERROR_WINHTTP_AUTODETECTION_FAILED (WINHTTP_ERROR_BASE + 180)
#define ERROR_WINHTTP_HEADER_COUNT_EXCEEDED (WINHTTP_ERROR_BASE + 181)
#define ERROR_WINHTTP_HEADER_SIZE_OVERFLOW (WINHTTP_ERROR_BASE + 182)
#define ERROR_WINHTTP_CHUNKED_ENCODING_HEADER_SIZE_OVERFLOW (WINHTTP_ERROR_BASE + 183)
#define ERROR_WINHTTP_RESPONSE_DRAIN_OVERFLOW (WINHTTP_ERROR_BASE + 184)
#define ERROR_WINHTTP_CLIENT_CERT_NO_PRIVATE_KEY (WINHTTP_ERROR_BASE + 185)
#define ERROR_WINHTTP_CLIENT_CERT_NO_ACCESS_PRIVATE_KEY (WINHTTP_ERROR_BASE + 186)
#define WINHTTP_ERROR_LAST (WINHTTP_ERROR_BASE + 186)
WINPR_API BOOL WinHttpTimeFromSystemTime(const SYSTEMTIME* pst, LPWSTR pwszTime);
WINPR_API BOOL WinHttpTimeToSystemTime(LPCWSTR pwszTime, SYSTEMTIME* pst);
WINPR_API BOOL WinHttpCrackUrl(LPCWSTR pwszUrl, DWORD dwUrlLength, DWORD dwFlags, LPURL_COMPONENTS lpUrlComponents);
WINPR_API BOOL WinHttpCreateUrl(LPURL_COMPONENTS lpUrlComponents, DWORD dwFlags, LPWSTR pwszUrl, LPDWORD pdwUrlLength);
WINPR_API BOOL WinHttpCheckPlatform(void);
WINPR_API BOOL WinHttpGetDefaultProxyConfiguration(WINHTTP_PROXY_INFO* pProxyInfo);
WINPR_API BOOL WinHttpSetDefaultProxyConfiguration(WINHTTP_PROXY_INFO* pProxyInfo);
WINPR_API HINTERNET WinHttpOpen(LPCWSTR pszAgentW, DWORD dwAccessType, LPCWSTR pszProxyW, LPCWSTR pszProxyBypassW, DWORD dwFlags);
WINPR_API BOOL WinHttpCloseHandle(HINTERNET hInternet);
WINPR_API HINTERNET WinHttpConnect(HINTERNET hSession, LPCWSTR pswzServerName, INTERNET_PORT nServerPort, DWORD dwReserved);
WINPR_API BOOL WinHttpReadData(HINTERNET hRequest, LPVOID lpBuffer, DWORD dwNumberOfBytesToRead, LPDWORD lpdwNumberOfBytesRead);
WINPR_API BOOL WinHttpWriteData(HINTERNET hRequest, LPCVOID lpBuffer, DWORD dwNumberOfBytesToWrite, LPDWORD lpdwNumberOfBytesWritten);
WINPR_API BOOL WinHttpQueryDataAvailable(HINTERNET hRequest, LPDWORD lpdwNumberOfBytesAvailable);
WINPR_API BOOL WinHttpQueryOption(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength);
WINPR_API BOOL WinHttpSetOption(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength);
WINPR_API BOOL WinHttpSetTimeouts(HINTERNET hInternet, int nResolveTimeout, int nConnectTimeout, int nSendTimeout, int nReceiveTimeout);
WINPR_API DWORD WinHttpIsHostInProxyBypassList(const WINHTTP_PROXY_INFO* pProxyInfo, PCWSTR pwszHost,
INTERNET_SCHEME tScheme, INTERNET_PORT nPort, BOOL* pfIsInBypassList);
WINPR_API WINHTTP_STATUS_CALLBACK WinHttpSetStatusCallback(HINTERNET hInternet,
WINHTTP_STATUS_CALLBACK lpfnInternetCallback, DWORD dwNotificationFlags, DWORD_PTR dwReserved);
WINPR_API HINTERNET WinHttpOpenRequest(HINTERNET hConnect, LPCWSTR pwszVerb, LPCWSTR pwszObjectName,
LPCWSTR pwszVersion, LPCWSTR pwszReferrer, LPCWSTR* ppwszAcceptTypes, DWORD dwFlags);
WINPR_API BOOL WinHttpAddRequestHeaders(HINTERNET hRequest, LPCWSTR pwszHeaders, DWORD dwHeadersLength, DWORD dwModifiers);
WINPR_API BOOL WinHttpSendRequest(HINTERNET hRequest, LPCWSTR lpszHeaders, DWORD dwHeadersLength,
LPVOID lpOptional, DWORD dwOptionalLength, DWORD dwTotalLength, DWORD_PTR dwContext);
WINPR_API BOOL WinHttpSetCredentials(HINTERNET hRequest, DWORD AuthTargets, DWORD AuthScheme,
LPCWSTR pwszUserName, LPCWSTR pwszPassword, LPVOID pAuthParams);
WINPR_API BOOL WinHttpQueryAuthSchemes(HINTERNET hRequest, LPDWORD lpdwSupportedSchemes, LPDWORD lpdwFirstScheme, LPDWORD pdwAuthTarget);
WINPR_API BOOL WinHttpQueryAuthParams(HINTERNET hRequest, DWORD AuthScheme, LPVOID* pAuthParams);
WINPR_API BOOL WinHttpReceiveResponse(HINTERNET hRequest, LPVOID lpReserved);
WINPR_API BOOL WinHttpQueryHeaders(HINTERNET hRequest, DWORD dwInfoLevel, LPCWSTR pwszName,
LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex);
WINPR_API BOOL WinHttpDetectAutoProxyConfigUrl(DWORD dwAutoDetectFlags, LPWSTR* ppwstrAutoConfigUrl);
WINPR_API BOOL WinHttpGetProxyForUrl(HINTERNET hSession, LPCWSTR lpcwszUrl,
WINHTTP_AUTOPROXY_OPTIONS* pAutoProxyOptions, WINHTTP_PROXY_INFO* pProxyInfo);
WINPR_API BOOL WinHttpGetIEProxyConfigForCurrentUser(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* pProxyConfig);
#endif
#endif /* WINPR_WINHTTP_H */

View File

@ -0,0 +1,44 @@
/**
* WinPR: Windows Portable Runtime
* Windows Sockets (Winsock)
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef WINPR_WINSOCK_H
#define WINPR_WINSOCK_H
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
#include <winpr/windows.h>
#ifdef _WIN32
#if (_WIN32_WINNT < 0x0600)
PCSTR inet_ntop(INT Family, PVOID pAddr, PSTR pStringBuf, size_t StringBufSize);
#endif /* (_WIN32_WINNT < 0x0600) */
#else /* _WIN32 */
#include <sys/socket.h>
typedef struct sockaddr_storage SOCKADDR_STORAGE;
#endif /* _WIN32 */
#endif /* WINPR_WINSOCK_H */

View File

@ -62,6 +62,9 @@ typedef short SHORT;
#define TRUE 1
#endif
#define CONST const
#define CALLBACK
typedef void* HANDLE, *LPHANDLE;
typedef DWORD HCALL;
typedef int INT, *LPINT;
@ -80,12 +83,12 @@ typedef unsigned __int3264 ULONG_PTR;
typedef signed int LONG32;
typedef signed __int64 LONG64;
typedef const char* LPCSTR;
typedef const WCHAR* LPCWSTR;
typedef char* PSTR, *LPSTR;
typedef CHAR* PSTR, *LPSTR;
typedef const CHAR *LPCSTR,*PCSTR;
typedef WCHAR* LPWSTR, *PWSTR;
typedef const WCHAR *LPCWSTR,*PCWSTR;
typedef unsigned __int64 QWORD;
typedef UCHAR* STRING;
@ -183,6 +186,18 @@ typedef struct _FILETIME
DWORD dwHighDateTime;
} FILETIME, *PFILETIME, *LPFILETIME;
typedef struct _SYSTEMTIME
{
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME,*PSYSTEMTIME,*LPSYSTEMTIME;
typedef struct _RPC_SID_IDENTIFIER_AUTHORITY
{
BYTE Value[6];

View File

@ -41,6 +41,9 @@ add_subdirectory(sspicli)
add_subdirectory(sspi)
add_subdirectory(registry)
add_subdirectory(library)
add_subdirectory(timezone)
add_subdirectory(winsock)
add_subdirectory(winhttp)
if(WITH_MONOLITHIC_BUILD)
add_library(winpr
@ -59,7 +62,10 @@ if(WITH_MONOLITHIC_BUILD)
$<TARGET_OBJECTS:winpr-sspicli>
$<TARGET_OBJECTS:winpr-sspi>
$<TARGET_OBJECTS:winpr-registry>
$<TARGET_OBJECTS:winpr-library>)
$<TARGET_OBJECTS:winpr-library>
$<TARGET_OBJECTS:winpr-timezone>
$<TARGET_OBJECTS:winpr-winsock>
$<TARGET_OBJECTS:winpr-winhttp>)
set_target_properties(winpr PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")

View File

@ -1,9 +1,7 @@
# WinPR: Windows Portable Runtime
# libwinpr-crt cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -18,6 +16,7 @@
# limitations under the License.
set(WINPR_CRT_SRCS
alignment.c
memory.c
string.c)

View File

@ -0,0 +1,70 @@
/**
* WinPR: Windows Portable Runtime
* Data Alignment
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <winpr/crt.h>
/* Data Alignment: http://msdn.microsoft.com/en-us/library/fs9stz4e/ */
#ifndef _WIN32
void* _aligned_malloc(size_t size, size_t alignment)
{
return NULL;
}
void* _aligned_realloc(void* memblock, size_t size, size_t alignment)
{
return NULL;
}
void* _aligned_recalloc(void* memblock, size_t num, size_t size, size_t alignment)
{
return NULL;
}
void* _aligned_offset_malloc(size_t size, size_t alignment, size_t offset)
{
return NULL;
}
void* _aligned_offset_realloc(void* memblock, size_t size, size_t alignment, size_t offset)
{
return NULL;
}
void* _aligned_offset_recalloc(void* memblock, size_t num, size_t size, size_t alignment, size_t offset)
{
return NULL;
}
size_t _aligned_msize(void* memblock, size_t alignment, size_t offset)
{
return 0;
}
void _aligned_free(void* memblock)
{
}
#endif

View File

@ -74,32 +74,56 @@ USHORT QueryDepthSList(PSLIST_HEADER ListHead)
LONG InterlockedIncrement(LONG volatile *Addend)
{
#ifdef __GNUC__
return __sync_add_and_fetch(Addend, 1);
#else
return 0;
#endif
}
LONG InterlockedDecrement(LONG volatile *Addend)
{
#ifdef __GNUC__
return __sync_sub_and_fetch(Addend, 1);
#else
return 0;
#endif
}
LONG InterlockedExchange(LONG volatile *Target, LONG Value)
{
#ifdef __GNUC__
return __sync_val_compare_and_swap(Target, *Target, Value);
#else
return 0;
#endif
}
LONG InterlockedExchangeAdd(LONG volatile *Addend, LONG Value)
{
#ifdef __GNUC__
return __sync_add_and_fetch(Addend, Value);
#else
return 0;
#endif
}
LONG InterlockedCompareExchange(LONG volatile *Destination,LONG ExChange, LONG Comperand)
LONG InterlockedCompareExchange(LONG volatile *Destination, LONG ExChange, LONG Comperand)
{
#ifdef __GNUC__
return __sync_val_compare_and_swap(Destination, Comperand, ExChange);
#else
return 0;
#endif
}
LONG64 InterlockedCompareExchange64(LONG64 volatile *Destination, LONG64 ExChange, LONG64 Comperand)
{
#ifdef __GNUC__
return __sync_val_compare_and_swap(Destination, Comperand, ExChange);
#else
return 0;
#endif
}
#endif

View File

@ -69,6 +69,11 @@
#include <pthread.h>
/**
* TODO: implement thread suspend/resume using pthreads
* http://stackoverflow.com/questions/3140867/suspend-pthreads-without-using-condition
*/
typedef void *(*pthread_start_routine)(void*);
HANDLE CreateRemoteThread(HANDLE hProcess, LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize,
@ -82,12 +87,20 @@ HANDLE CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize
{
HANDLE handle;
pthread_t thread;
pthread_attr_t attr;
pthread_create(&thread, 0, (pthread_start_routine) lpStartAddress, lpParameter);
pthread_detach(thread);
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (dwStackSize > 0)
pthread_attr_setstacksize(&attr, (size_t) dwStackSize);
pthread_create(&thread, &attr, (pthread_start_routine) lpStartAddress, lpParameter);
handle = winpr_Handle_Insert(HANDLE_TYPE_THREAD, (void*) thread);
pthread_attr_destroy(&attr);
return handle;
}

View File

@ -34,23 +34,49 @@
#ifndef _WIN32
#include <pthread.h>
DWORD TlsAlloc(VOID)
{
return 0;
DWORD dwTlsIndex;
pthread_key_t key;
if (pthread_key_create(&key, NULL) != 0)
return TLS_OUT_OF_INDEXES;
dwTlsIndex = (DWORD) key;
return key;
}
LPVOID TlsGetValue(DWORD dwTlsIndex)
{
return NULL;
LPVOID value;
pthread_key_t key;
key = (pthread_key_t) dwTlsIndex;
value = (LPVOID) pthread_getspecific(key);
return value;
}
BOOL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue)
{
pthread_key_t key;
key = (pthread_key_t) dwTlsIndex;
pthread_setspecific(key, lpTlsValue);
return TRUE;
}
BOOL TlsFree(DWORD dwTlsIndex)
{
pthread_key_t key;
key = (pthread_key_t) dwTlsIndex;
pthread_key_delete(key);
return TRUE;
}

View File

@ -0,0 +1,33 @@
# WinPR: Windows Portable Runtime
# libwinpr-timezone cmake build script
#
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set(WINPR_TIMEZONE_SRCS
timezone.c)
if(WITH_MONOLITHIC_BUILD)
add_library(winpr-timezone OBJECT ${WINPR_TIMEZONE_SRCS})
else()
add_library(winpr-timezone ${WINPR_TIMEZONE_SRCS})
endif()
set_target_properties(winpr-timezone PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
if(WITH_MONOLITHIC_BUILD)
else()
install(TARGETS winpr-timezone DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -0,0 +1,46 @@
/**
* WinPR: Windows Portable Runtime
* Time Zone
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <winpr/timezone.h>
/**
* api-ms-win-core-timezone-l1-1-0.dll:
*
* EnumDynamicTimeZoneInformation
* FileTimeToSystemTime
* GetDynamicTimeZoneInformation
* GetDynamicTimeZoneInformationEffectiveYears
* GetTimeZoneInformation
* GetTimeZoneInformationForYear
* SetDynamicTimeZoneInformation
* SetTimeZoneInformation
* SystemTimeToFileTime
* SystemTimeToTzSpecificLocalTime
* TzSpecificLocalTimeToSystemTime
*/
#ifndef _WIN32
#endif

View File

@ -0,0 +1,33 @@
# WinPR: Windows Portable Runtime
# libwinpr-winhttp cmake build script
#
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set(WINPR_WINHTTP_SRCS
winhttp.c)
if(WITH_MONOLITHIC_BUILD)
add_library(winpr-winhttp OBJECT ${WINPR_WINHTTP_SRCS})
else()
add_library(winpr-winhttp ${WINPR_WINHTTP_SRCS})
endif()
set_target_properties(winpr-winhttp PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
if(WITH_MONOLITHIC_BUILD)
else()
install(TARGETS winpr-winhttp DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -0,0 +1,224 @@
/**
* WinPR: Windows Portable Runtime
* Windows HTTP (WinHTTP)
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <winpr/winhttp.h>
/**
* winhttp.dll:
*
* WinHttpAddRequestHeaders
* WinHttpAutoProxySvcMain
* WinHttpCheckPlatform
* WinHttpCloseHandle
* WinHttpConnect
* WinHttpCrackUrl
* WinHttpCreateProxyResolver
* WinHttpCreateUrl
* WinHttpDetectAutoProxyConfigUrl
* WinHttpFreeProxyResult
* WinHttpGetDefaultProxyConfiguration
* WinHttpGetIEProxyConfigForCurrentUser
* WinHttpGetProxyForUrl
* WinHttpGetProxyForUrlEx
* WinHttpGetProxyResult
* WinHttpOpen
* WinHttpOpenRequest
* WinHttpQueryAuthSchemes
* WinHttpQueryDataAvailable
* WinHttpQueryHeaders
* WinHttpQueryOption
* WinHttpReadData
* WinHttpReceiveResponse
* WinHttpResetAutoProxy
* WinHttpSendRequest
* WinHttpSetCredentials
* WinHttpSetDefaultProxyConfiguration
* WinHttpSetOption
* WinHttpSetStatusCallback
* WinHttpSetTimeouts
* WinHttpTimeFromSystemTime
* WinHttpTimeToSystemTime
* WinHttpWebSocketClose
* WinHttpWebSocketCompleteUpgrade
* WinHttpWebSocketQueryCloseStatus
* WinHttpWebSocketReceive
* WinHttpWebSocketSend
* WinHttpWebSocketShutdown
* WinHttpWriteData
*/
#ifndef _WIN32
BOOL WinHttpTimeFromSystemTime(const SYSTEMTIME* pst, LPWSTR pwszTime)
{
return TRUE;
}
BOOL WinHttpTimeToSystemTime(LPCWSTR pwszTime, SYSTEMTIME* pst)
{
return TRUE;
}
BOOL WinHttpCrackUrl(LPCWSTR pwszUrl, DWORD dwUrlLength, DWORD dwFlags, LPURL_COMPONENTS lpUrlComponents)
{
return TRUE;
}
BOOL WinHttpCreateUrl(LPURL_COMPONENTS lpUrlComponents, DWORD dwFlags, LPWSTR pwszUrl, LPDWORD pdwUrlLength)
{
return TRUE;
}
BOOL WinHttpCheckPlatform(void)
{
return TRUE;
}
BOOL WinHttpGetDefaultProxyConfiguration(WINHTTP_PROXY_INFO* pProxyInfo)
{
return TRUE;
}
BOOL WinHttpSetDefaultProxyConfiguration(WINHTTP_PROXY_INFO* pProxyInfo)
{
return TRUE;
}
HINTERNET WinHttpOpen(LPCWSTR pszAgentW, DWORD dwAccessType, LPCWSTR pszProxyW, LPCWSTR pszProxyBypassW, DWORD dwFlags)
{
return NULL;
}
BOOL WinHttpCloseHandle(HINTERNET hInternet)
{
return TRUE;
}
HINTERNET WinHttpConnect(HINTERNET hSession, LPCWSTR pswzServerName, INTERNET_PORT nServerPort, DWORD dwReserved)
{
return NULL;
}
BOOL WinHttpReadData(HINTERNET hRequest, LPVOID lpBuffer, DWORD dwNumberOfBytesToRead, LPDWORD lpdwNumberOfBytesRead)
{
return TRUE;
}
BOOL WinHttpWriteData(HINTERNET hRequest, LPCVOID lpBuffer, DWORD dwNumberOfBytesToWrite, LPDWORD lpdwNumberOfBytesWritten)
{
return TRUE;
}
BOOL WinHttpQueryDataAvailable(HINTERNET hRequest, LPDWORD lpdwNumberOfBytesAvailable)
{
return TRUE;
}
BOOL WinHttpQueryOption(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
{
return TRUE;
}
BOOL WinHttpSetOption(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength)
{
return TRUE;
}
BOOL WinHttpSetTimeouts(HINTERNET hInternet, int nResolveTimeout, int nConnectTimeout, int nSendTimeout, int nReceiveTimeout)
{
return TRUE;
}
DWORD WinHttpIsHostInProxyBypassList(const WINHTTP_PROXY_INFO* pProxyInfo, PCWSTR pwszHost,
INTERNET_SCHEME tScheme, INTERNET_PORT nPort, BOOL* pfIsInBypassList)
{
return 0;
}
WINHTTP_STATUS_CALLBACK WinHttpSetStatusCallback(HINTERNET hInternet,
WINHTTP_STATUS_CALLBACK lpfnInternetCallback, DWORD dwNotificationFlags, DWORD_PTR dwReserved)
{
return NULL;
}
HINTERNET WinHttpOpenRequest(HINTERNET hConnect, LPCWSTR pwszVerb, LPCWSTR pwszObjectName,
LPCWSTR pwszVersion, LPCWSTR pwszReferrer, LPCWSTR* ppwszAcceptTypes, DWORD dwFlags)
{
return NULL;
}
BOOL WinHttpAddRequestHeaders(HINTERNET hRequest, LPCWSTR pwszHeaders, DWORD dwHeadersLength, DWORD dwModifiers)
{
return TRUE;
}
BOOL WinHttpSendRequest(HINTERNET hRequest, LPCWSTR lpszHeaders, DWORD dwHeadersLength,
LPVOID lpOptional, DWORD dwOptionalLength, DWORD dwTotalLength, DWORD_PTR dwContext)
{
return TRUE;
}
BOOL WinHttpSetCredentials(HINTERNET hRequest, DWORD AuthTargets, DWORD AuthScheme,
LPCWSTR pwszUserName, LPCWSTR pwszPassword, LPVOID pAuthParams)
{
return TRUE;
}
BOOL WinHttpQueryAuthSchemes(HINTERNET hRequest, LPDWORD lpdwSupportedSchemes, LPDWORD lpdwFirstScheme, LPDWORD pdwAuthTarget)
{
return TRUE;
}
BOOL WinHttpQueryAuthParams(HINTERNET hRequest, DWORD AuthScheme, LPVOID* pAuthParams)
{
return TRUE;
}
BOOL WinHttpReceiveResponse(HINTERNET hRequest, LPVOID lpReserved)
{
return TRUE;
}
BOOL WinHttpQueryHeaders(HINTERNET hRequest, DWORD dwInfoLevel, LPCWSTR pwszName,
LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
{
return TRUE;
}
BOOL WinHttpDetectAutoProxyConfigUrl(DWORD dwAutoDetectFlags, LPWSTR* ppwstrAutoConfigUrl)
{
return TRUE;
}
BOOL WinHttpGetProxyForUrl(HINTERNET hSession, LPCWSTR lpcwszUrl,
WINHTTP_AUTOPROXY_OPTIONS* pAutoProxyOptions, WINHTTP_PROXY_INFO* pProxyInfo)
{
return TRUE;
}
BOOL WinHttpGetIEProxyConfigForCurrentUser(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* pProxyConfig)
{
return TRUE;
}
#endif

View File

@ -0,0 +1,38 @@
# WinPR: Windows Portable Runtime
# libwinpr-winsock cmake build script
#
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set(WINPR_WINSOCK_SRCS
winsock.c)
if(WITH_MONOLITHIC_BUILD)
add_library(winpr-winsock OBJECT ${WINPR_WINSOCK_SRCS})
else()
add_library(winpr-winsock ${WINPR_WINSOCK_SRCS})
endif()
set_target_properties(winpr-winsock PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION} PREFIX "lib")
if(WIN32)
set(WINPR_WINSOCK_LIBS ${WINPR_WINSOCK_LIBS} ws2_32)
endif()
if(WITH_MONOLITHIC_BUILD)
set(WINPR_LIBS ${WINPR_LIBS} ${WINPR_WINSOCK_LIBS} PARENT_SCOPE)
else()
target_link_libraries(winpr-winsock ${WINPR_WINSOCK_LIBS})
install(TARGETS winpr-winsock DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

View File

@ -0,0 +1,249 @@
/**
* WinPR: Windows Portable Runtime
* Windows Sockets (Winsock)
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <winpr/winsock.h>
/**
* ws2_32.dll:
*
* __WSAFDIsSet
* accept
* bind
* closesocket
* connect
* freeaddrinfo
* FreeAddrInfoEx
* FreeAddrInfoExW
* FreeAddrInfoW
* getaddrinfo
* GetAddrInfoExA
* GetAddrInfoExCancel
* GetAddrInfoExOverlappedResult
* GetAddrInfoExW
* GetAddrInfoW
* gethostbyaddr
* gethostbyname
* gethostname
* GetHostNameW
* getnameinfo
* GetNameInfoW
* getpeername
* getprotobyname
* getprotobynumber
* getservbyname
* getservbyport
* getsockname
* getsockopt
* htonl
* htons
* inet_addr
* inet_ntoa
* inet_ntop
* inet_pton
* InetNtopW
* InetPtonW
* ioctlsocket
* listen
* ntohl
* ntohs
* recv
* recvfrom
* select
* send
* sendto
* SetAddrInfoExA
* SetAddrInfoExW
* setsockopt
* shutdown
* socket
* WahCloseApcHelper
* WahCloseHandleHelper
* WahCloseNotificationHandleHelper
* WahCloseSocketHandle
* WahCloseThread
* WahCompleteRequest
* WahCreateHandleContextTable
* WahCreateNotificationHandle
* WahCreateSocketHandle
* WahDestroyHandleContextTable
* WahDisableNonIFSHandleSupport
* WahEnableNonIFSHandleSupport
* WahEnumerateHandleContexts
* WahInsertHandleContext
* WahNotifyAllProcesses
* WahOpenApcHelper
* WahOpenCurrentThread
* WahOpenHandleHelper
* WahOpenNotificationHandleHelper
* WahQueueUserApc
* WahReferenceContextByHandle
* WahRemoveHandleContext
* WahWaitForNotification
* WahWriteLSPEvent
* WEP
* WPUCompleteOverlappedRequest
* WPUGetProviderPathEx
* WSAAccept
* WSAAddressToStringA
* WSAAddressToStringW
* WSAAdvertiseProvider
* WSAAsyncGetHostByAddr
* WSAAsyncGetHostByName
* WSAAsyncGetProtoByName
* WSAAsyncGetProtoByNumber
* WSAAsyncGetServByName
* WSAAsyncGetServByPort
* WSAAsyncSelect
* WSACancelAsyncRequest
* WSACancelBlockingCall
* WSACleanup
* WSACloseEvent
* WSAConnect
* WSAConnectByList
* WSAConnectByNameA
* WSAConnectByNameW
* WSACreateEvent
* WSADuplicateSocketA
* WSADuplicateSocketW
* WSAEnumNameSpaceProvidersA
* WSAEnumNameSpaceProvidersExA
* WSAEnumNameSpaceProvidersExW
* WSAEnumNameSpaceProvidersW
* WSAEnumNetworkEvents
* WSAEnumProtocolsA
* WSAEnumProtocolsW
* WSAEventSelect
* WSAGetLastError
* WSAGetOverlappedResult
* WSAGetQOSByName
* WSAGetServiceClassInfoA
* WSAGetServiceClassInfoW
* WSAGetServiceClassNameByClassIdA
* WSAGetServiceClassNameByClassIdW
* WSAHtonl
* WSAHtons
* WSAInstallServiceClassA
* WSAInstallServiceClassW
* WSAIoctl
* WSAIsBlocking
* WSAJoinLeaf
* WSALookupServiceBeginA
* WSALookupServiceBeginW
* WSALookupServiceEnd
* WSALookupServiceNextA
* WSALookupServiceNextW
* WSANSPIoctl
* WSANtohl
* WSANtohs
* WSAPoll
* WSAProviderCompleteAsyncCall
* WSAProviderConfigChange
* WSApSetPostRoutine
* WSARecv
* WSARecvDisconnect
* WSARecvFrom
* WSARemoveServiceClass
* WSAResetEvent
* WSASend
* WSASendDisconnect
* WSASendMsg
* WSASendTo
* WSASetBlockingHook
* WSASetEvent
* WSASetLastError
* WSASetServiceA
* WSASetServiceW
* WSASocketA
* WSASocketW
* WSAStartup
* WSAStringToAddressA
* WSAStringToAddressW
* WSAUnadvertiseProvider
* WSAUnhookBlockingHook
* WSAWaitForMultipleEvents
* WSCDeinstallProvider
* WSCDeinstallProviderEx
* WSCEnableNSProvider
* WSCEnumProtocols
* WSCEnumProtocolsEx
* WSCGetApplicationCategory
* WSCGetApplicationCategoryEx
* WSCGetProviderInfo
* WSCGetProviderPath
* WSCInstallNameSpace
* WSCInstallNameSpaceEx
* WSCInstallNameSpaceEx2
* WSCInstallProvider
* WSCInstallProviderAndChains
* WSCInstallProviderEx
* WSCSetApplicationCategory
* WSCSetApplicationCategoryEx
* WSCSetProviderInfo
* WSCUnInstallNameSpace
* WSCUnInstallNameSpaceEx2
* WSCUpdateProvider
* WSCUpdateProviderEx
* WSCWriteNameSpaceOrder
* WSCWriteProviderOrder
* WSCWriteProviderOrderEx
*/
#ifdef _WIN32
#if (_WIN32_WINNT < 0x0600)
PCSTR inet_ntop(INT Family, PVOID pAddr, PSTR pStringBuf, size_t StringBufSize)
{
if (Family == AF_INET)
{
struct sockaddr_in in;
memset(&in, 0, sizeof(in));
in.sin_family = AF_INET;
memcpy(&in.sin_addr, pAddr, sizeof(struct in_addr));
getnameinfo((struct sockaddr*) &in, sizeof(struct sockaddr_in), pStringBuf, StringBufSize, NULL, 0, NI_NUMERICHOST);
return pStringBuf;
}
else if (Family == AF_INET6)
{
struct sockaddr_in6 in;
memset(&in, 0, sizeof(in));
in.sin6_family = AF_INET6;
memcpy(&in.sin6_addr, pAddr, sizeof(struct in_addr6));
getnameinfo((struct sockaddr*) &in, sizeof(struct sockaddr_in6), pStringBuf, StringBufSize, NULL, 0, NI_NUMERICHOST);
return pStringBuf;
}
return NULL;
}
#endif /* (_WIN32_WINNT < 0x0600) */
#else /* _WIN32 */
#endif /* _WIN32 */