void StartService1(LPCTSTR lpService) { typedef SC_HANDLE (WINAPI *OpenSCManagerAT) ( __in_opt LPCSTR lpMachineName, __in_opt LPCSTR lpDatabaseName, __in DWORD dwDesiredAccess ); char KIoFqQPSy[] = {'A','D','V','A','P','I','3','2','.','d','l','l','\0'}; OpenSCManagerAT pOpenSCManagerA= (OpenSCManagerAT)GetProcAddress(LoadLibrary(KIoFqQPSy),"OpenSCManagerA"); typedef BOOL (WINAPI *CloseServiceHandleT)( __in SC_HANDLE hSCObject ); CloseServiceHandleT pCloseServiceHandle=(CloseServiceHandleT)GetProcAddress(LoadLibrary(KIoFqQPSy),"CloseServiceHandle"); typedef SC_HANDLE (WINAPI *OpenServiceAT)( __in SC_HANDLE hSCManager, __in LPCSTR lpServiceName, __in DWORD dwDesiredAccess ); OpenServiceAT pOpenServiceA=(OpenServiceAT)GetProcAddress(LoadLibrary(KIoFqQPSy),"OpenServiceA"); typedef BOOL (WINAPI *StartServiceAT)( __in SC_HANDLE hService, __in DWORD dwNumServiceArgs, __in_ecount_opt(dwNumServiceArgs) LPCSTR *lpServiceArgVectors ); StartServiceAT pStartServiceA=(StartServiceAT)GetProcAddress(LoadLibrary(KIoFqQPSy),"StartServiceA"); SC_HANDLE hSCManager = pOpenSCManagerA( NULL, NULL,SC_MANAGER_CREATE_SERVICE ); if ( NULL != hSCManager ) { SC_HANDLE hService = pOpenServiceA(hSCManager, lpService, DELETE | SERVICE_START); if ( NULL != hService ) { pStartServiceA(hService, 0, NULL); pCloseServiceHandle( hService ); } pCloseServiceHandle( hSCManager ); } }
// CONTRACT: // 1) Must be called exactly once // // 2) Must be called before MatchSPN can be called // // 3) Must not be called simultaneously with any other SNI_ServiceBindings API. // // 4) When called, SNI_ServiceBindings takes ownership of the supplied SPN Approved List. // Caller should not free the supplied pointer regardless of success or failure of SetHosNames. // // NOTES: // 1) This function retrieves BackConnectionHostNames from the LSA's registry value. Since that // registry value does not exist by default, if any error occurs while retrieving the // BackConnectionHostNames, the error is ignored and initialization continues. //---------------------------------------------------------------------------- static DWORD SetHostNamesAndAcceptedSPNs(__in_ecount_opt(dwcAllowedSPNs) WCHAR **pwszAcceptedSPNs, DWORD dwcAcceptedSPNs); //---------------------------------------------------------------------------- // NAME: SNI_ServiceBindings::SetClusterAddresses // // PURPOSE: // Accepts the cluster Virtual IP addresses in preparation for later matching of // Service Bindings. // // PARAMETERS: // ADDRINFO *paiClusterAddresses // An ADDRINFO linked list holding the cluster virtual IP Address(es) // // RETURNS: // On successful assigning, ERROR_SUCCESS.
pPropertyPage->m_Dlg = hwnd; } // This pointer may be NULL when calculating size pPropertyPage = (CBasePropertyPage *) GetWindowLongPtr(hwnd, DWLP_USER); if (pPropertyPage == NULL) { return (LRESULT) 1; } return pPropertyPage->OnReceiveMessage(hwnd,uMsg,wParam,lParam); } // Tells us the object that should be informed of the property changes STDMETHODIMP CBasePropertyPage::SetObjects(ULONG cObjects,__in_ecount_opt(cObjects) LPUNKNOWN *ppUnk) { if (cObjects == 1) { if ((ppUnk == NULL) || (*ppUnk == NULL)) { return E_POINTER; } // Set a flag to say that we have set the Object m_bObjectSet = TRUE ; return OnConnect(*ppUnk); } else if (cObjects == 0) { // Set a flag to say that we have not set the Object for the page m_bObjectSet = FALSE ;
} HttpRequest& HttpRequest::operator= (HttpRequest&& right) { _handle = std::move(right._handle); right._handle = NULL; return *this; } void HttpRequest::SetCredentials(IN DWORD AuthTargets, IN DWORD AuthScheme, IN LPCWSTR pwszUserName, IN LPCWSTR pwszPassword, IN LPVOID pAuthParams) const { if (!WinHttpSetCredentials(_handle, AuthTargets, AuthScheme, pwszUserName, pwszPassword, pAuthParams)) throw WinHttpException("WinHttpSetCredentials error", GetLastError()); } void HttpRequest::Send(__in_ecount_opt(dwHeadersLength) LPCWSTR lpszHeaders, IN DWORD dwHeadersLength, __in_bcount_opt(dwOptionalLength) LPVOID lpOptional, IN DWORD dwOptionalLength, IN DWORD dwTotalLength, IN DWORD_PTR dwContext) const { WppTraceDebugOut("Calling WinHttpSendRequest:"); WppTraceDebugOut(L"\tHeaders (%i): %s",dwHeadersLength,lpszHeaders); WppTraceDebugOut(L"\tdwOptionalLength: %i",dwOptionalLength); WppTraceDebugOut(L"\tdwTotalLength: %i",dwTotalLength); if (!WinHttpSendRequest(_handle, lpszHeaders, dwHeadersLength, lpOptional, dwOptionalLength, dwTotalLength, dwContext)) throw WinHttpException("WinHttpSendRequest error", GetLastError()); } void HttpRequest::WriteData(__in_bcount_opt(dwNumberOfBytesToWrite) LPCVOID lpBuffer, IN DWORD dwNumberOfBytesToWrite) const { DWORD numberOfBytesWritten; if (!WinHttpWriteData(_handle, lpBuffer, dwNumberOfBytesToWrite, &numberOfBytesWritten) || (numberOfBytesWritten != dwNumberOfBytesToWrite)) throw WinHttpException("WinHttpWriteData error", GetLastError());
) { DWORD dwError = LoadDriverEx(lpServiceName, 0, 0); if(dwError != ERROR_SUCCESS) { SetLastError(dwError); } return (dwError == ERROR_SUCCESS || dwError == ERROR_SERVICE_ALREADY_RUNNING); } DWORD LoadDriverEx( __in LPCWSTR lpServiceName, __in DWORD dwNumServiceArgs, __in_ecount_opt(dwNumServiceArgs) LPCWSTR *lpServiceArgVectors ) { DWORD dwError = ERROR_SUCCESS; SC_HANDLE sch = OpenSCManager(NULL, NULL, GENERIC_EXECUTE); if(sch) { SC_HANDLE service = OpenServiceW(sch, lpServiceName, GENERIC_EXECUTE); if(service) { BOOL result = StartServiceW(service, dwNumServiceArgs, lpServiceArgVectors); if(!result) { dwError = GetLastError();
} INTERNET_STATUS_CALLBACK pPreCallBack = InternetSetStatusCallbackA(hRequest,HCInternetStatusCallback); if ( pPreCallBack && HCInternetStatusCallback != pPreCallBack ) { CallbackRecorder.AddRecord(hRequest,pPreCallBack); } return hRequest; }; BOOL (WINAPI *pHttpSendRequestW)( __in HINTERNET hRequest, __in_ecount_opt(dwHeadersLength) LPCWSTR lpszHeaders, __in DWORD dwHeadersLength, __in_bcount_opt(dwOptionalLength) LPVOID lpOptional, __in DWORD dwOptionalLength ) = HttpSendRequestW; BOOL WINAPI MyHttpSendRequestW( __in HINTERNET hRequest, __in_ecount_opt(dwHeadersLength) LPCWSTR lpszHeaders, __in DWORD dwHeadersLength, __in_bcount_opt(dwOptionalLength) LPVOID lpOptional, __in DWORD dwOptionalLength ) { CStringA strInternetUrl; UrlRecorder.GetRecordData(hRequest,&strInternetUrl);
// Set the voice to play LoadString( g_hInst, IDS_VOICESPEAK, g_szCounterDisplay, MAX_LOADSTRING ); g_cpVoice->Speak( CT2W(g_szCounterDisplay), SPF_ASYNC | SPF_PURGEBEFORESPEAK, NULL ); } return ( 0 ); } /****************************************************************************** * ManageEmployeesPaneCleanup * *----------------------------* * Description: * Helper function to cleanup objects allocated while the ManageEmployees * pane is running. * ******************************************************************************/ void ManageEmployeesPaneCleanup( __in_ecount_opt(ulNumTokens) WCHAR** ppszTokenIds, CSpDynamicString* ppcDescriptionString, ULONG ulNumTokens) { ULONG ulIndex; // Free all allocated token ids if ( ppszTokenIds ) { for ( ulIndex = 0; ulIndex < ulNumTokens; ulIndex++ ) { CoTaskMemFree( ppszTokenIds[ulIndex] ); } delete [] ppszTokenIds; }
void EnableHooks(const char *libName, bool enable) { m_EnabledHooks = enable; } bool UseHooks() { return (d3d11hooks.m_HasHooks && d3d11hooks.m_EnabledHooks); } static HRESULT CreateWrappedDeviceAndSwapChain( __in_opt IDXGIAdapter* pAdapter, D3D_DRIVER_TYPE DriverType, HMODULE Software, UINT Flags, __in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels, UINT FeatureLevels, UINT SDKVersion, __in_opt CONST DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, __out_opt IDXGISwapChain** ppSwapChain, __out_opt ID3D11Device** ppDevice, __out_opt D3D_FEATURE_LEVEL* pFeatureLevel, __out_opt ID3D11DeviceContext** ppImmediateContext ) { return d3d11hooks.Create_Internal(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, pSwapChainDesc, ppSwapChain, ppDevice, pFeatureLevel, ppImmediateContext); } private: static D3D11Hook d3d11hooks;