コード例 #1
0
#include <wincred.h>
#include <Shlwapi.h>
#include <shellapi.h>

#define CURL_STATICLIB
#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>

typedef DWORD (WINAPI * CredUIPromptForWindowsCredentialsW_t)(
								   __in_opt PCREDUI_INFOW pUiInfo,
								   __in DWORD dwAuthError,
								   __inout ULONG *pulAuthPackage,
								   __in_bcount_opt(ulInAuthBufferSize) LPCVOID pvInAuthBuffer,
								   __in ULONG ulInAuthBufferSize,
								   __deref_out_bcount_full(*pulOutAuthBufferSize) LPVOID * ppvOutAuthBuffer,
								   __out ULONG * pulOutAuthBufferSize,
								   __inout_opt BOOL *pfSave,
								   __in DWORD dwFlags
								   );

typedef BOOL (WINAPI * CredUnPackAuthenticationBufferW_t)(
								__in DWORD                                      dwFlags,
								__in_bcount(cbAuthBuffer) PVOID                 pAuthBuffer,
								__in DWORD                                      cbAuthBuffer,
								__out_ecount_opt(*pcchMaxUserName) LPWSTR       pszUserName,
								__inout DWORD*                                  pcchMaxUserName,
								__out_ecount_opt(*pcchMaxDomainName) LPWSTR     pszDomainName,
								__inout_opt DWORD*                              pcchMaxDomainName,
								__out_ecount_opt(*pcchMaxPassword) LPWSTR       pszPassword,
								__inout DWORD*                                  pcchMaxPassword
コード例 #2
0
ファイル: sni_io.hpp プロジェクト: ericshenjs/microsoft
		// From SNI's perspective, the "varying" packets are treated as "buffer-less"
		if ((SNI_Packet_VaryingBufferRead == pPacket->m_IOType) || 
			(SNI_Packet_VaryingBufferWrite == pPacket->m_IOType))
		{
			pPacket->m_pBuffer = NULL;
			pPacket->m_pNext = NULL;
			pPacket->m_cBufferSize = 0;
		}

		pPacket->m_cbBuffer = 0;
		pPacket->m_IOType = IOType;
		pPacket->m_ConsBuf = ConsNum;
	}

	// Returns pointer to the relevant data buffer and the size of the data buffer
	friend void SNIPacketGetData(__in SNI_Packet * pPacket, __deref_out_bcount_full(*pcbBuf) BYTE ** ppBuf, __out DWORD * pcbBuf)
	{
		Assert (pPacket->m_cBufferSize >= pPacket->m_OffSet);
		Assert (pPacket->m_OffSet + pPacket->m_cbBuffer <= pPacket->m_cBufferSize);
		*ppBuf = (BYTE *)(pPacket->m_pBuffer + pPacket->m_OffSet);
		*pcbBuf = pPacket->m_cbBuffer;
	}

	// Copies buffer to the packet's data buffer FROM the point of the currect offset
	// and adjusts the size accordingly
	// Note: THIS DOES NOT ADJUST THE OFFSET VALUE
	// Note: Typically to be used by consumers
	friend void SNIPacketSetData(__inout SNI_Packet * pPacket, __in_bcount(cbBuf) const BYTE * pbBuf, __in DWORD cbBuf)
	{
#ifndef SNI_BASED_CLIENT
		// If we adjust the offset or the data size, then zeroing the memory