⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mssoap.cpp

📁 Windows CE 6.0 Server 源码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft shared
// source or premium shared source license agreement under which you licensed
// this source code. If you did not accept the terms of the license agreement,
// you are not authorized to use this source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the SOURCE.RTF on your install media or the root of your tools installation.
// THE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
//+---------------------------------------------------------------------------------
//
//
// File:
//      mssoap.cpp
//
// Contents:
//
//      Implementation of DLL Exports.
//
//----------------------------------------------------------------------------------

#define INIT_SOAP_GLOBALS
#define MYINIT_GUID                 // Includes GUID instances

#ifdef UNDER_CE
#include "objbase.h"
#include "WinCEUtils.h"
#endif


#include "headers.h"


extern "C" HINSTANCE Get_ResourceHINSTANCE();

#ifdef _CRTDBG_MAP_ALLOC
    HANDLE    hfile; 
#endif

#ifdef UNDER_CE
 CRITICAL_SECTION g_csGIT;
 DWORD            g_dwGITRefCnt;
#endif 


BOOL    DllProcessAttach(HINSTANCE hInstDLL);
BOOL    DllProcessDetach();

STDAPI SoapMsg_RegisterServer(CHAR *pModName);
STDAPI SoapMsg_UnregisterServer(void);
STDAPI SoapConn_RegisterServer(CHAR *pModName);
STDAPI SoapConn_UnregisterServer(void);
STDAPI SoapSer_RegisterServer(CHAR *pModName);
STDAPI SoapSer_UnregisterServer(void);
STDAPI SoapReader_RegisterServer(CHAR *pModName);
STDAPI SoapReader_UnregisterServer(void);
STDAPI Wsdl_RegisterServer(CHAR * pModName);
STDAPI Wsdl_UnregisterServer(void);




BEGIN_FACTORY_MAP(CClassFactory)
    //  ADD_FACTORY_PRODUCT_FTM(clsid, class)
    ADD_FACTORY_PRODUCT_FTM(CLSID_SoapConnectorFactory, CSoapConnectorFactory)
    ADD_FACTORY_PRODUCT_FTM(CLSID_SoapServer, CSoapServer)
    ADD_FACTORY_PRODUCT_FTM(CLSID_SoapClient, CSoapClient)
    ADD_FACTORY_PRODUCT_FTM(CLSID_SoapSerializer, CSoapSerializer)
    ADD_FACTORY_PRODUCT_FTM(CLSID_SoapReader, CSoapReader)
    ADD_FACTORY_PRODUCT_FTM(CLSID_WSDLReader, CWSDLReader)
    ADD_FACTORY_PRODUCT_FTM(CLSID_EnumWSDLService, CEnumWSDLService)
    ADD_FACTORY_PRODUCT_FTM(CLSID_WSDLService, CWSDLService)
    ADD_FACTORY_PRODUCT_FTM(CLSID_WSDLPort, CWSDLPort)
    ADD_FACTORY_PRODUCT_FTM(CLSID_WSDLOperation, CWSDLOperation)
    ADD_FACTORY_PRODUCT_FTM(CLSID_EnumWSDLOperations, CEnumWSDLOperations)
    ADD_FACTORY_PRODUCT_FTM(CLSID_EnumSoapMappers, CEnumSoapMappers)
    ADD_FACTORY_PRODUCT_FTM(CLSID_EnumWSDLPorts, CEnumWSDLPorts)
    ADD_FACTORY_PRODUCT_FTM(CLSID_SoapMapper, CSoapMapper)
    ADD_FACTORY_PRODUCT_FTM(CLSID_SoapTypeMapperFactory, CTypeMapperFactory)    

    { &CLSID_HttpConnector, CHttpConnector::CreateObject, CHttpConnector::CreateObject },

END_FACTORY_MAP(CClassFactory)



////////////////////////////////////////////////////////////////////////////////////////////////////
//  function: static bool isWin9x(void)
//
//  parameters:
//          
//  description:
//  returns:
//          
////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef UNDER_CE
static bool isWin9x(void)
{    
    bool bIsWin9x;
    OSVERSIONINFOA osver;

    osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
    GetVersionExA(&osver);

    bIsWin9x = !!(osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS);
    TRACEL((1, "Running under Win9x: %s\n", bIsWin9x ? "true" : "false"));
    return bIsWin9x;
}
#endif




////////////////////////////////////////////////////////////////////////////////////////////////////
//  function: DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
//
//  parameters:
//          
//  description:    DLL Entry Point
//  returns:
//          
////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef UNDER_CE
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
#else
BOOL APIENTRY DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved) 
#endif
{
    BOOL    fRetVal = TRUE;        // assume successful.
#ifndef UNDER_CE
    g_hInstance = hInstance;
#else
    g_hInstance = (HINSTANCE)hInstance;
#endif

    switch( dwReason )
    {
        case DLL_PROCESS_ATTACH:
#ifndef UNDER_CE
            fRetVal = DllProcessAttach(hInstance);
#else   
            fRetVal = DllProcessAttach((HINSTANCE)hInstance);
#endif

            break;
        case DLL_PROCESS_DETACH:
            fRetVal = DllProcessDetach();
            break;
    }
    return fRetVal;
}


#ifndef UNDER_CE
bool g_fIsWin9x = false;
#endif

////////////////////////////////////////////////////////////////////////////////////////////////////
//  function: DllProcessAttach(HINSTANCE hInstDLL)
//
//  parameters:
//          
//  description:
//  returns:
//          
////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL DllProcessAttach(HINSTANCE hInstDLL)
{
    BOOL fRetVal = TRUE;
#ifndef UNDER_CE   
    HRESULT hr = S_OK;
    char  szModuleName[MAX_RES_STRING_SIZE + 1];
    char *  psz;
    char *  pszlocale;
    char *  pszcurpath;
    DWORD   cch;
    LCID    lcid;
#endif 

    SET_TRACE_LEVEL(3);

    // Disable the DLL_THREAD_ATTACH and DLL_THREAD_DETACH 
    // notifications for this DLL
    DisableThreadLibraryCalls(hInstDLL);

#ifdef UNDER_CE
    InitializeCriticalSection(&g_csGIT);
    g_dwGITRefCnt = 0;
#endif 

    // initialize Soaputil DLL
    InitSoaputil();

#ifndef UNDER_CE
    g_fIsWin9x = isWin9x();
   
    //
    // Load Localization DLL
    //
    cch = GetModuleFileNameA(hInstDLL, szModuleName, MAX_RES_STRING_SIZE);
    if (cch == 0)
    {
        hr = GetLastError();
        fRetVal = FALSE;
        goto Cleanup;
    }
    // Find the path of the file
    psz = &(szModuleName[cch - 1]);
    while ((psz >= szModuleName) && (*psz != '\\') && (*psz != '/'))
        psz--;
    psz++; 
    pszcurpath = psz;
    strncpy(psz, "Resources\\", (MAX_RES_STRING_SIZE - (psz - szModuleName)));
    lcid = GetSystemDefaultLCID();
    pszlocale = szModuleName + strlen(szModuleName);
    ltoa (lcid, pszlocale, 10);
    psz = szModuleName + strlen(szModuleName);
    *psz = (char)'\\';
    psz++;
    strncpy(psz, "MSSOAPR.DLL", (MAX_RES_STRING_SIZE - (psz - szModuleName)));     
    
    g_hInstance_language = LoadLibraryExA(szModuleName, NULL, 
            LOAD_WITH_ALTERED_SEARCH_PATH);

    if( !g_hInstance_language )
    {
        // If not found, try the local default 1033 (US English) 
        strncpy(pszlocale, "1033\\MSSOAPR.DLL", (MAX_RES_STRING_SIZE - (pszlocale - szModuleName)));
        g_hInstance_language = LoadLibraryExA(szModuleName, NULL, 
            LOAD_WITH_ALTERED_SEARCH_PATH);
        if( !g_hInstance_language )
        {
            // Finally look for it in the current directory 
            strncpy(pszcurpath, "MSSOAPR.DLL", (MAX_RES_STRING_SIZE - (pszcurpath - szModuleName)));
            g_hInstance_language = LoadLibraryExA(szModuleName, NULL, 
                LOAD_WITH_ALTERED_SEARCH_PATH);
                
            if( !g_hInstance_language )
            {
#ifdef DEBUG
                // For DEBUG version only, check the path ..\..\..\mssoapres\objd\i386\mssoapr.dll
                // This hack is convenient for development debugging.
                // Go up three directories
                psz = pszcurpath - 2;
                for ( int i = 0 ; i < 3 ; i++)
                {
                    while ((psz >= szModuleName) && (*psz != '\\') && (*psz != '/'))
                        psz--;
                    psz--;    
                }    
                psz++; 
                psz++;
                strncpy(psz, "mssoapres\\objd\\i386\\MSSOAPR.DLL", 
                        (MAX_RES_STRING_SIZE - (psz - szModuleName)));
                g_hInstance_language = LoadLibraryExA(szModuleName, NULL, 
                    LOAD_WITH_ALTERED_SEARCH_PATH);
                if (g_hInstance_language)
                {
                    fRetVal = TRUE;
                }
                else
                {
#endif
                    fRetVal = FALSE;
                    goto Cleanup;
#ifdef DEBUG
                }    
#endif
            }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -