├── BuildProcessTemplates ├── DefaultTemplate.11.1.xaml ├── DefaultTemplate.xaml ├── LabDefaultTemplate.11.xaml └── UpgradeTemplate.xaml ├── License.txt ├── README.md ├── include ├── atlcache.h ├── atlcrypt.h ├── atlcrypt.inl ├── atlextmgmt.h ├── atlhtml.h ├── atlhttp.h ├── atlhttp.inl ├── atlisapi.h ├── atlmime.h ├── atlperf.h ├── atlperf.inl ├── atlrx.h ├── atlserr.h ├── atlsession.h ├── atlsharedsvc.h ├── atlsiface.h ├── atlsmtpconnection.h ├── atlsmtputil.h ├── atlsoap.h ├── atlspriv.h ├── atlspriv.inl ├── atlsrv.rc ├── atlsrvres.h ├── atlstencil.h ├── l.chs │ └── atlsrv.rc ├── l.cht │ └── atlsrv.rc ├── l.deu │ └── atlsrv.rc ├── l.esp │ └── atlsrv.rc ├── l.fra │ └── atlsrv.rc ├── l.ita │ └── atlsrv.rc ├── l.jpn │ └── atlsrv.rc ├── l.kor │ └── atlsrv.rc └── res │ ├── dllmgr.srf │ ├── stencilmgr.srf │ └── threadmgr.srf └── source ├── CLStencil ├── ReadMe.htm ├── StdAfx.cpp ├── StdAfx.h ├── clstencil.cpp ├── clstencil.h ├── clstencil.rc ├── clstencil.sln ├── clstencil.vcproj ├── clstencilui.mak ├── clstencilui.vcproj └── resource.h ├── SProxy ├── Attribute.h ├── AttributeParser.cpp ├── AttributeParser.h ├── CodeTypeBuilder.cpp ├── CodeTypeBuilder.h ├── CodeTypes.h ├── ComplexType.cpp ├── ComplexType.h ├── ComplexTypeParser.cpp ├── ComplexTypeParser.h ├── Content.cpp ├── Content.h ├── ContentParser.cpp ├── ContentParser.h ├── CppCodeGenerator.cpp ├── CppCodeGenerator.h ├── CppKeywordTable.h ├── DiscoMapDocument.cpp ├── DiscoMapDocument.h ├── DiscoMapParser.cpp ├── DiscoMapParser.h ├── Element.cpp ├── Element.h ├── ElementParser.cpp ├── ElementParser.h ├── Emit.cpp ├── Emit.h ├── ErrorHandler.cpp ├── ErrorHandler.h ├── FacetMappingTable.h ├── Namespaces.h ├── Parser.cpp ├── Parser.h ├── QName.cpp ├── QName.h ├── ReadMe.txt ├── Schema.cpp ├── Schema.h ├── SchemaDocument.h ├── SchemaParser.cpp ├── SchemaParser.h ├── SimpleType.h ├── SimpleTypeParser.cpp ├── SimpleTypeParser.h ├── SkipParser.h ├── SproxyColl.h ├── SproxyError.h ├── StdAfx.cpp ├── StdAfx.h ├── Util.cpp ├── Util.h ├── WSDLBinding.cpp ├── WSDLBinding.h ├── WSDLBindingParser.cpp ├── WSDLBindingParser.h ├── WSDLDocument.h ├── WSDLMessage.h ├── WSDLMessageParser.cpp ├── WSDLMessageParser.h ├── WSDLMessagePart.cpp ├── WSDLMessagePart.h ├── WSDLOperationIOParser.cpp ├── WSDLOperationIOParser.h ├── WSDLOperationParser.cpp ├── WSDLOperationParser.h ├── WSDLParser.cpp ├── WSDLParser.h ├── WSDLPort.cpp ├── WSDLPort.h ├── WSDLPortType.h ├── WSDLPortTypeIO.cpp ├── WSDLPortTypeIO.h ├── WSDLPortTypeOperation.h ├── WSDLPortTypeParser.cpp ├── WSDLPortTypeParser.h ├── WSDLService.h ├── WSDLServiceParser.cpp ├── WSDLServiceParser.h ├── WSDLServicePortParser.cpp ├── WSDLServicePortParser.h ├── WSDLSoapElement.cpp ├── WSDLSoapElement.h ├── WSDLType.h ├── WSDLTypesParser.cpp ├── WSDLTypesParser.h ├── XMLDocParser.cpp ├── XMLDocParser.h ├── XMLDocument.cpp ├── XMLDocument.h ├── XMLElement.cpp ├── XMLElement.h ├── XSDElement.h ├── XSDMappingTable.h ├── cppkeywords.in ├── errordefs.h ├── facets.in ├── makefile ├── makefile.inc ├── msxml2.h ├── resource.h ├── sources ├── sproxy.cpp ├── sproxy.mak ├── sproxy.rc ├── sproxy.sln ├── sproxy.srf ├── sproxy.vcproj ├── utils │ ├── cppkw.c │ ├── mkutils.cmd │ └── static_hash.c ├── wsdl_rpc.srf └── xsdtypes.in └── VCDeploy ├── api.cpp ├── api.h ├── atlsdply.cpp ├── atlsdply.rc ├── depsettings.cpp ├── depsettings.h ├── iiisext.h ├── iisext_i.c ├── resource.h ├── stdafx.cpp ├── stdafx.h ├── vcdeploy.sln └── vcdeploy.vcproj /License.txt: -------------------------------------------------------------------------------- 1 | Microsoft Limited Permissive License (Ms-LPL) 2 | 3 | This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. 4 | 5 | 1. Definitions 6 | The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. 7 | A "contribution" is the original software, or any additions or changes to the software. 8 | A "contributor" is any person that distributes its contribution under this license. 9 | "Licensed patents" are a contributor's patent claims that read directly on its contribution. 10 | 11 | 2. Grant of Rights 12 | (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. 13 | (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. 14 | 15 | 3. Conditions and Limitations 16 | (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. 17 | (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. 18 | (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. 19 | (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. 20 | (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. 21 | (F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend only to the software or derivative works that you create that run on a Microsoft Windows operating system product. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ATL Server 2 | 3 | ## Origin 4 | 5 | *ATL Server is a technology originally developed by Microsoft for developing web-based applications.* 6 | 7 | The ALT Server code was pulled down [CodePlex](http://atlserver.codeplex.com/) before it was [shut down](https://blogs.msdn.microsoft.com/bharry/2017/03/31/shutting-down-codeplex/). Every effort was made to preserve history of the original authors using widely [accepted methods](https://john.albin.net/git/convert-subversion-to-git) available at the time, but it would just hang forever when cloning using git-svn. 8 | 9 | ## Wacky SVN 10 | 11 | I'm not sure if the CodePlex `svn` server/bridge is jacked, but there were a few things that didn't look right are probably worth pointing out. 12 | 13 | ### Authors 14 | 15 | Here is an example `authors-transform.txt`: 16 | 17 | ``` 18 | RNO\V-BCHRIS = RNO\V-BCHRIS 19 | RNO\_TFSSERVICE = RNO\_TFSSERVICE 20 | SND\atlsadmin_cp = SND\atlsadmin_cp 21 | vstfs:///Framework/IdentityDomain/2327b42d-5241-43d6-9e2a-de5ac946f064\Project Collection Service Accounts = vstfs:///Framework/IdentityDomain/2327b42d-5241-43d6-9e2a-de5ac946f064\Project Collection Service Accounts 22 | ``` 23 | 24 | As you can see, it's hard to know *who* deserves credit. 25 | 26 | ### Revisions 27 | 28 | Also, the revisions shown with `svn log -q` gave inconsistent results and lead me to belove that they couldn't be trusted. 29 | 30 | ### Proper Migrations 31 | 32 | Hopefully this code will get migrated by the owners of the ALT Server project on CodePlex using the tools built in collaboration with GitHub and this repo will no longer be needed. 33 | 34 | ### Conclusion 35 | 36 | I did all I could to properly move this code. Please let me know if I should take it down because a proper migration exists somewhere else. 37 | 38 | Read more about the [project](https://en.wikipedia.org/wiki/ATL_Server) and find the [reference](https://msdn.microsoft.com/en-us/magazine/t9adwcde.aspx) over at MSDN. 39 | -------------------------------------------------------------------------------- /include/l.chs/atlsrv.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabegundy/atlserver/e2f585fc7e073f7195564be86717e3faec79346e/include/l.chs/atlsrv.rc -------------------------------------------------------------------------------- /include/l.cht/atlsrv.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabegundy/atlserver/e2f585fc7e073f7195564be86717e3faec79346e/include/l.cht/atlsrv.rc -------------------------------------------------------------------------------- /include/l.deu/atlsrv.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabegundy/atlserver/e2f585fc7e073f7195564be86717e3faec79346e/include/l.deu/atlsrv.rc -------------------------------------------------------------------------------- /include/l.esp/atlsrv.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabegundy/atlserver/e2f585fc7e073f7195564be86717e3faec79346e/include/l.esp/atlsrv.rc -------------------------------------------------------------------------------- /include/l.fra/atlsrv.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabegundy/atlserver/e2f585fc7e073f7195564be86717e3faec79346e/include/l.fra/atlsrv.rc -------------------------------------------------------------------------------- /include/l.ita/atlsrv.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabegundy/atlserver/e2f585fc7e073f7195564be86717e3faec79346e/include/l.ita/atlsrv.rc -------------------------------------------------------------------------------- /include/l.jpn/atlsrv.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabegundy/atlserver/e2f585fc7e073f7195564be86717e3faec79346e/include/l.jpn/atlsrv.rc -------------------------------------------------------------------------------- /include/l.kor/atlsrv.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabegundy/atlserver/e2f585fc7e073f7195564be86717e3faec79346e/include/l.kor/atlsrv.rc -------------------------------------------------------------------------------- /include/res/dllmgr.srf: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 |

ATL Server DLL Cache Manager

16 | 17 | Current DLL Cache Entries: {{GetNumEntries}}

18 | 19 | 20 | 21 | 22 | {{while EnumEntries}} 23 | 24 | {{endwhile}} 25 | 26 |
DLL PathRef Count
{{GetDllName}}{{GetDllReferences}}
27 | 28 | 29 | -------------------------------------------------------------------------------- /include/res/stencilmgr.srf: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 |

15 | ATL Server Stencil Cache Management 16 |

17 | 18 | 19 | 21 | {{while GetNextStencilCacheStats}} 22 | 23 | 24 | 25 | 26 | {{endwhile}} 27 |
20 | ValueQuantity
{{GetCacheValue}}{{GetCacheQuantity}}
28 |
29 | 30 | 36 |
37 | 38 |
39 | 40 |
41 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /include/res/threadmgr.srf: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 |

15 | ATL Server Thread Pool Management 16 |

17 | This server's thread pool is currently using {{GetSize}} threads.

18 |

19 | 20 | Enter a new thread pool size: 21 | 22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /source/CLStencil/ReadMe.htm: -------------------------------------------------------------------------------- 1 |  3 | 4 | CLStencil Sample: Runs Request Handler DLLs or SRF Files from the Command Line

CLStencil Sample: Runs Request Handler DLLs or SRF Files from the Command Line

Demonstrates how to provide custom implementations of IHttpServerContext and IIsapiExtension to create a command-line tool for generating responses from SRF files and Web application DLLs without requiring IIS.

Note that CLStencil only provides a partial implementation of IHttpServerContext and CIsapiExtension. Items that are specific to a Web server, such as IHttpServerContext::MapUrlToPathEx, are not supported.

CLStencil tries to locate server variables in the current environment, so if the request handler needs a specific server variable, be sure to set it in the environment before running the application. For example, you can run the following command at a command prompt to make the SERVER_PROTOCOL variable available to CLStencil and the request handlers it loads:

SET SERVER_PROTOCOL=HTTP/1.1.

Security Note

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices.

Building and Running the Sample

It is not necessary to build this sample to see the tool in action. The executable file (clstencil.exe) is shipped with Visual Studio in the Vc7\bin directory. Instructions for use can be found below:

To use CLStencil

  • Run clstencil.exe from the command line using the following command:

    clstencil i SrfFile o OutputFile e ErrorFile

    Where:

    SrfFile   The name of the SRF file to be processed.

    OutputFile   The name of the file to which the generated content will be written.

    ErrorFile   The name of the file to which warning and error messages will be written.

    Run clstencil.exe with no arguments for more information on its command line arguments.

Demonstrates

IHttpServerContext | IIsapiExtension | AtlServerRequest

7 | -------------------------------------------------------------------------------- /source/CLStencil/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // clstencil.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | // This source code is only intended as a supplement to the 7 | // Microsoft Classes Reference and related electronic 8 | // documentation provided with the library. 9 | // See these sources for detailed information regarding the 10 | // Microsoft C++ Libraries products. 11 | 12 | #include "stdafx.h" 13 | 14 | // TODO: reference any additional headers you need in STDAFX.H 15 | // and not in this file 16 | -------------------------------------------------------------------------------- /source/CLStencil/StdAfx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | // Copyright (c) Microsoft Corporation. All rights reserved. 6 | // 7 | // This source code is only intended as a supplement to the 8 | // Microsoft Classes Reference and related electronic 9 | // documentation provided with the library. 10 | // See these sources for detailed information regarding the 11 | // Microsoft C++ Libraries products. 12 | 13 | #if !defined(AFX_STDAFX_H__1114FD51_D788_4B00_80A9_9D9485A0F7D7__INCLUDED_) 14 | #define AFX_STDAFX_H__1114FD51_D788_4B00_80A9_9D9485A0F7D7__INCLUDED_ 15 | 16 | #if _MSC_VER > 1000 17 | #pragma once 18 | #endif // _MSC_VER > 1000 19 | 20 | 21 | // Insert your headers here 22 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 23 | #define _WIN32_WINNT 0x0502 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include "clstencil.h" 30 | 31 | //{{AFX_INSERT_LOCATION}} 32 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 33 | 34 | #endif // !defined(AFX_STDAFX_H__1114FD51_D788_4B00_80A9_9D9485A0F7D7__INCLUDED_) 35 | -------------------------------------------------------------------------------- /source/CLStencil/clstencil.rc: -------------------------------------------------------------------------------- 1 | //Microsoft Developer Studio generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "afxres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (U.S.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | #pragma code_page(1252) 22 | #endif //_WIN32 23 | 24 | #ifdef APSTUDIO_INVOKED 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // 27 | // TEXTINCLUDE 28 | // 29 | 30 | 1 TEXTINCLUDE 31 | BEGIN 32 | "resource.h\0" 33 | END 34 | 35 | 2 TEXTINCLUDE 36 | BEGIN 37 | "#include ""afxres.h""\r\n" 38 | "\0" 39 | END 40 | 41 | 3 TEXTINCLUDE 42 | BEGIN 43 | "\r\n" 44 | "\0" 45 | END 46 | 47 | #endif // APSTUDIO_INVOKED 48 | 49 | ///////////////////////////////////////////////////////////////////////////// 50 | // 51 | // VERSION 52 | // 53 | #ifdef RC_INVOKED 54 | 55 | #define VER_FILETYPE VFT_APP 56 | 57 | #define VER_FILEDESCRIPTION_STR "Microsoft \256 ATL Server Command Line Stencil Processor" 58 | 59 | #define VER_INTERNALNAME_STR "CLSTENCIL" 60 | 61 | #define VER_ORIGINALFILENAME_STR "CLSTENCIL.EXE" 62 | 63 | #define VER_COPYRIGHTSTARTYEAR_STR "1999" 64 | 65 | #include "ver_.rc" 66 | 67 | #endif 68 | 69 | 70 | ///////////////////////////////////////////////////////////////////////////// 71 | // 72 | // String Table 73 | // 74 | 75 | STRINGTABLE 76 | BEGIN 77 | IDS_HEADER "Microsoft (R) Command Line Stencil Processor 7.00.9128\r\nCopyright (c) Microsoft Corporation 2005. All rights reserved.\r\n\r\n" 78 | IDS_NOTSUPPORTED "%s not supported in command line mode.\n" 79 | IDS_USAGE "Usage: clstencil -i inputfile -o outputfile [-n] [-q ""querystring""] [-f forminput] [-e errorlog] [-c content-type] [-v verb]\n-i inputfile : the .srf or .dll to process\n-n : suppress startup banner\n-o outputfile : the file to write to (defaults to stdout)\n-q ""querystring"" : the query string to pass to the processor\n-f forminput : the input file for user data (e.g. form data) (defaults to stdin)\n-e errorlog : the file where errors are written (defaults to stderr)\n-c ""content-type"" : the content type of the request\n-v verb : the request verb\n" 80 | IDS_ERROR "Error: %s\n" 81 | IDS_UNKNOWN_PARAM "Unknown Parameter: %s" 82 | IDS_INPUT_FILE "You must provide an input file" 83 | IDS_INVALID_ARGS "Invalid number of arguments" 84 | IDS_INIT_FAILED "ERROR: Failed to initialize extension\n" 85 | IDS_SERVER_VARIABLE_NOT_FOUND 86 | "WARNING: GetServerVariable: variable %s not found in the environment\n" 87 | IDS_QS_TOO_LONG "ERROR: querystring too long" 88 | IDS_CT_TOO_LONG "ERROR: content-type of the request too long" 89 | IDS_VERB_TOO_LONG "ERROR: request verb too long" 90 | END 91 | 92 | #endif // English (U.S.) resources 93 | ///////////////////////////////////////////////////////////////////////////// 94 | 95 | 96 | 97 | #ifndef APSTUDIO_INVOKED 98 | ///////////////////////////////////////////////////////////////////////////// 99 | // 100 | // Generated from the TEXTINCLUDE 3 resource. 101 | // 102 | 103 | 104 | ///////////////////////////////////////////////////////////////////////////// 105 | #endif // not APSTUDIO_INVOKED 106 | 107 | -------------------------------------------------------------------------------- /source/CLStencil/clstencil.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 9.00 2 | # Visual Studio 2005 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clstencil", "clstencil.vcproj", "{001C823F-0CA4-4B47-BC00-7EFA1B8104AF}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clstencilui", "clstencilui.vcproj", "{9A27D633-9C74-4C4E-93FB-F9DFCCEFEDBE}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Itanium = Debug|Itanium 10 | Debug|Win32 = Debug|Win32 11 | Debug|x64 = Debug|x64 12 | Release|Itanium = Release|Itanium 13 | Release|Win32 = Release|Win32 14 | Release|x64 = Release|x64 15 | EndGlobalSection 16 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 17 | {001C823F-0CA4-4B47-BC00-7EFA1B8104AF}.Debug|Itanium.ActiveCfg = Debug|Itanium 18 | {001C823F-0CA4-4B47-BC00-7EFA1B8104AF}.Debug|Itanium.Build.0 = Debug|Itanium 19 | {001C823F-0CA4-4B47-BC00-7EFA1B8104AF}.Debug|Win32.ActiveCfg = Debug|Win32 20 | {001C823F-0CA4-4B47-BC00-7EFA1B8104AF}.Debug|Win32.Build.0 = Debug|Win32 21 | {001C823F-0CA4-4B47-BC00-7EFA1B8104AF}.Debug|x64.ActiveCfg = Debug|x64 22 | {001C823F-0CA4-4B47-BC00-7EFA1B8104AF}.Debug|x64.Build.0 = Debug|x64 23 | {001C823F-0CA4-4B47-BC00-7EFA1B8104AF}.Release|Itanium.ActiveCfg = Release|Itanium 24 | {001C823F-0CA4-4B47-BC00-7EFA1B8104AF}.Release|Itanium.Build.0 = Release|Itanium 25 | {001C823F-0CA4-4B47-BC00-7EFA1B8104AF}.Release|Win32.ActiveCfg = Release|Win32 26 | {001C823F-0CA4-4B47-BC00-7EFA1B8104AF}.Release|Win32.Build.0 = Release|Win32 27 | {001C823F-0CA4-4B47-BC00-7EFA1B8104AF}.Release|x64.ActiveCfg = Release|x64 28 | {001C823F-0CA4-4B47-BC00-7EFA1B8104AF}.Release|x64.Build.0 = Release|x64 29 | {9A27D633-9C74-4C4E-93FB-F9DFCCEFEDBE}.Debug|Itanium.ActiveCfg = Debug|Itanium 30 | {9A27D633-9C74-4C4E-93FB-F9DFCCEFEDBE}.Debug|Itanium.Build.0 = Debug|Itanium 31 | {9A27D633-9C74-4C4E-93FB-F9DFCCEFEDBE}.Debug|Win32.ActiveCfg = Debug|Win32 32 | {9A27D633-9C74-4C4E-93FB-F9DFCCEFEDBE}.Debug|Win32.Build.0 = Debug|Win32 33 | {9A27D633-9C74-4C4E-93FB-F9DFCCEFEDBE}.Debug|x64.ActiveCfg = Debug|x64 34 | {9A27D633-9C74-4C4E-93FB-F9DFCCEFEDBE}.Debug|x64.Build.0 = Debug|x64 35 | {9A27D633-9C74-4C4E-93FB-F9DFCCEFEDBE}.Release|Itanium.ActiveCfg = Release|Itanium 36 | {9A27D633-9C74-4C4E-93FB-F9DFCCEFEDBE}.Release|Itanium.Build.0 = Release|Itanium 37 | {9A27D633-9C74-4C4E-93FB-F9DFCCEFEDBE}.Release|Win32.ActiveCfg = Release|Win32 38 | {9A27D633-9C74-4C4E-93FB-F9DFCCEFEDBE}.Release|Win32.Build.0 = Release|Win32 39 | {9A27D633-9C74-4C4E-93FB-F9DFCCEFEDBE}.Release|x64.ActiveCfg = Release|x64 40 | {9A27D633-9C74-4C4E-93FB-F9DFCCEFEDBE}.Release|x64.Build.0 = Release|x64 41 | EndGlobalSection 42 | GlobalSection(SolutionProperties) = preSolution 43 | HideSolutionNode = FALSE 44 | EndGlobalSection 45 | EndGlobal 46 | -------------------------------------------------------------------------------- /source/CLStencil/clstencilui.mak: -------------------------------------------------------------------------------- 1 | !ifndef DEBUG 2 | DEBUG=1 3 | !endif 4 | 5 | TARGETNAME=clstencil 6 | RCFILE=$(TARGETNAME).rc 7 | 8 | 9 | # Default PLATFORM depending on host environment 10 | !if "$(PLATFORM)" == "" 11 | !if "$(PROCESSOR_ARCHITECTURE)" == "" 12 | !error PLATFORM must be set to intended target 13 | !endif 14 | !if "$(PROCESSOR_ARCHITECTURE)" == "x86" 15 | PLATFORM=INTEL 16 | !endif 17 | !endif 18 | 19 | 20 | 21 | # 22 | # PLATFORM options 23 | # 24 | LINK32=link 25 | RC=rc 26 | 27 | # 28 | # TARGET platform 29 | # 30 | !if "$(TARGET)" == "" 31 | !if "$(PROCESSOR_ARCHITECTURE)" == "AMD64" 32 | TARGET=amd64 33 | !else if "$(PROCESSOR_ARCHITECTURE)" == "IA64" 34 | TARGET=ia64 35 | !endif 36 | !endif 37 | 38 | # 39 | # Object File Directory 40 | # 41 | !ifndef D 42 | !if "$(DEBUG)" == "0" 43 | D=Release$(_OD_EXT) 44 | !else 45 | D=Debug$(_OD_EXT) 46 | !endif 47 | !if "$(UNICODE)" == "1" 48 | D=$(D)U 49 | !endif 50 | !if "$(TARGET)" != "" 51 | D=$(TARGET)\$(D) 52 | !endif 53 | !endif 54 | 55 | # 56 | # link /MACHINE: option 57 | # 58 | !if "$(TARGET)" == "" 59 | LINK_MACHINE=X86 60 | !else if "$(TARGET)" == "amd64" 61 | LINK_MACHINE=X64 62 | !else if "$(TARGET)" == "x64" 63 | LINK_MACHINE=X64 64 | !else if "$(TARGET)" == "ia64" 65 | LINK_MACHINE=IA64 66 | !endif 67 | 68 | DEFS=$(DEFS) $(DEBDEFS) $(TARGDEFS) 69 | RCFLAGS=$(RCFLAGS) /l 0x409 $(DEFS) 70 | 71 | ############################################################################# 72 | # Goals to build 73 | 74 | GOALS=resource_dll 75 | goal: $(GOALS) 76 | 77 | create.dir: 78 | @-if not exist $D\*.* mkdir $D 79 | 80 | clean: 81 | -if exist $D\*.obj erase $D\*.obj 82 | -if exist $D\*.pch erase $D\*.pch 83 | -if exist $D\*.res erase $D\*.res 84 | -if exist $D\*.rsc erase $D\*.rsc 85 | -if exist $D\*.map erase $D\*.map 86 | -if exist $D\*.pdb erase $D\*.pdb 87 | -if exist $D\*.tlb erase $D\*.tlb 88 | -if exist $D\*.h erase $D\*.h 89 | -if not exist $D\*.* rmdir $D 90 | 91 | 92 | RESFILE=$(D)\$(RCFILE:.rc=.res) 93 | 94 | 95 | resource_dll: 96 | -if not exist $(D) mkdir $(D) 97 | $(RC) $(RCFLAGS) /fo$(RESFILE) $(RCFILE) 98 | -if not exist $(D)\1033 mkdir $(D)\1033 99 | $(LINK32) /MACHINE:$(LINK_MACHINE) $(RESFILE) -DLL -NOENTRY /out:$(D)\1033\$(TARGETNAME)UI.dll 100 | -------------------------------------------------------------------------------- /source/CLStencil/clstencilui.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 17 | 20 | 21 | 22 | 23 | 24 | 31 | 44 | 45 | 52 | 65 | 66 | 73 | 86 | 87 | 94 | 107 | 108 | 115 | 128 | 129 | 136 | 149 | 150 | 151 | 152 | 153 | 154 | 159 | 160 | 165 | 166 | 171 | 174 | 175 | 176 | 180 | 181 | 182 | 183 | 184 | 185 | -------------------------------------------------------------------------------- /source/CLStencil/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by clstencil.rc 4 | // 5 | #define IDS_HEADER 101 6 | #define IDS_NOTSUPPORTED 102 7 | #define IDS_USAGE 103 8 | #define IDS_ERROR 104 9 | #define IDS_UNKNOWN_PARAM 105 10 | #define IDS_INPUT_FILE 106 11 | #define IDS_INVALID_ARGS 107 12 | #define IDS_INIT_FAILED 108 13 | #define IDS_SERVER_VARIABLE_NOT_FOUND 109 14 | #define IDS_QS_TOO_LONG 110 15 | #define IDS_CONTENT_TYPE_TOO_LONG 111 16 | #define IDS_CT_TOO_LONG 111 17 | #define IDS_VERB_TOO_LONG 112 18 | 19 | // Next default values for new objects 20 | // 21 | #ifdef APSTUDIO_INVOKED 22 | #ifndef APSTUDIO_READONLY_SYMBOLS 23 | #define _APS_NEXT_RESOURCE_VALUE 109 24 | #define _APS_NEXT_COMMAND_VALUE 40001 25 | #define _APS_NEXT_CONTROL_VALUE 1000 26 | #define _APS_NEXT_SYMED_VALUE 101 27 | #endif 28 | #endif 29 | -------------------------------------------------------------------------------- /source/SProxy/AttributeParser.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // AttributeParser.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "AttributeParser.h" 11 | #include "Attribute.h" 12 | 13 | TAG_METHOD_IMPL(CAttributeParser, OnAnnotation) 14 | { 15 | TRACE_PARSE_ENTRY(); 16 | 17 | return SkipElement(); 18 | } 19 | 20 | TAG_METHOD_IMPL(CAttributeParser, OnSimpleType) 21 | { 22 | TRACE_PARSE_ENTRY(); 23 | 24 | return SkipElement(); 25 | } 26 | 27 | ATTR_METHOD_IMPL(CAttributeParser, OnForm) 28 | { 29 | TRACE_PARSE_ENTRY(); 30 | 31 | CAttribute * pCurr = GetAttribute(); 32 | if (pCurr != NULL) 33 | { 34 | return pCurr->SetAttributeForm(wszValue, cchValue); 35 | } 36 | 37 | Emit(IDS_SDL_INTERNAL); 38 | 39 | return E_FAIL; 40 | } 41 | 42 | ATTR_METHOD_IMPL(CAttributeParser, OnRef) 43 | { 44 | TRACE_PARSE_ENTRY(); 45 | 46 | CAttribute * pCurr = GetAttribute(); 47 | if (pCurr != NULL) 48 | { 49 | return pCurr->SetRef(wszValue, cchValue); 50 | } 51 | 52 | Emit(IDS_SDL_INTERNAL); 53 | 54 | return E_FAIL; 55 | } 56 | 57 | ATTR_METHOD_IMPL(CAttributeParser, OnName) 58 | { 59 | TRACE_PARSE_ENTRY(); 60 | 61 | CAttribute * pCurr = GetAttribute(); 62 | if (pCurr != NULL) 63 | { 64 | return pCurr->SetName(wszValue, cchValue); 65 | } 66 | 67 | Emit(IDS_SDL_INTERNAL); 68 | 69 | return E_FAIL; 70 | } 71 | 72 | ATTR_METHOD_IMPL(CAttributeParser, OnType) 73 | { 74 | TRACE_PARSE_ENTRY(); 75 | 76 | CAttribute * pCurr = GetAttribute(); 77 | if (pCurr != NULL) 78 | { 79 | return pCurr->SetType(wszValue, cchValue); 80 | } 81 | 82 | Emit(IDS_SDL_INTERNAL); 83 | 84 | return E_FAIL; 85 | } 86 | 87 | ATTR_METHOD_IMPL(CAttributeParser, OnUse) 88 | { 89 | TRACE_PARSE_ENTRY(); 90 | 91 | CAttribute * pCurr = GetAttribute(); 92 | if (pCurr != NULL) 93 | { 94 | return pCurr->SetAttributeUse(wszValue, cchValue); 95 | } 96 | 97 | Emit(IDS_SDL_INTERNAL); 98 | 99 | return E_FAIL; 100 | } 101 | 102 | ATTR_METHOD_IMPL(CAttributeParser, OnValue) 103 | { 104 | TRACE_PARSE_ENTRY(); 105 | 106 | CAttribute * pCurr = GetAttribute(); 107 | if (pCurr != NULL) 108 | { 109 | return pCurr->SetValue(wszValue, cchValue); 110 | } 111 | 112 | Emit(IDS_SDL_INTERNAL); 113 | 114 | return E_FAIL; 115 | } 116 | 117 | ATTR_METHOD_IMPL(CAttributeParser, OnID) 118 | { 119 | TRACE_PARSE_ENTRY(); 120 | 121 | CAttribute * pCurr = GetAttribute(); 122 | if (pCurr != NULL) 123 | { 124 | return pCurr->SetID(wszValue, cchValue); 125 | } 126 | 127 | Emit(IDS_SDL_INTERNAL); 128 | 129 | return E_FAIL; 130 | } 131 | 132 | ATTR_METHOD_IMPL(CAttributeParser, OnArrayType) 133 | { 134 | TRACE_PARSE_ENTRY(); 135 | 136 | CAttribute *pCurr = GetAttribute(); 137 | if (pCurr != NULL) 138 | { 139 | return pCurr->SetArrayType(wszValue, cchValue); 140 | } 141 | 142 | Emit(IDS_SDL_INTERNAL); 143 | 144 | return E_FAIL; 145 | } 146 | 147 | HRESULT CAttributeParser::ValidateElement() 148 | { 149 | // emit a warning when we encounter an attribute that is 150 | // not an arrayType attribute 151 | CAttribute *pCurr = GetAttribute(); 152 | if (pCurr != NULL) 153 | { 154 | if (!pCurr->GetArrayType().GetLength()) 155 | { 156 | EmitFileWarning(IDS_SDL_NO_ATTRIBUTES, pCurr, 0); 157 | } 158 | } 159 | 160 | return S_OK; 161 | } -------------------------------------------------------------------------------- /source/SProxy/AttributeParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // AttributeParser.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Parser.h" 11 | #include "Emit.h" 12 | #include "resource.h" 13 | 14 | class CAttribute; 15 | 16 | class CAttributeParser : public CParserBase 17 | { 18 | private: 19 | 20 | CAttribute *m_pAttribute; 21 | 22 | public: 23 | 24 | inline CAttributeParser(ISAXXMLReader *pReader, CParserBase *pParent, DWORD dwLevel, CAttribute *pAttribute = NULL) 25 | :CParserBase(pReader, pParent, dwLevel), m_pAttribute(pAttribute) 26 | { 27 | } 28 | 29 | inline CAttribute * GetAttribute() 30 | { 31 | return m_pAttribute; 32 | } 33 | 34 | inline void SetAttribute(CAttribute *pAttribute) 35 | { 36 | m_pAttribute = pAttribute; 37 | } 38 | 39 | HRESULT ValidateElement(); 40 | 41 | /* 42 | 51 | Content: (annotation? , (simpleType?)) 52 | 53 | */ 54 | BEGIN_XMLTAG_MAP() 55 | XMLTAG_ENTRY_EX("annotation", XSD_NAMESPACEA, OnAnnotation) 56 | XMLTAG_ENTRY_EX("simpleType", XSD_NAMESPACEA, OnSimpleType) 57 | END_XMLTAG_MAP() 58 | 59 | BEGIN_XMLATTR_MAP() 60 | XMLATTR_ENTRY("form", OnForm) 61 | XMLATTR_ENTRY("ref", OnRef) 62 | XMLATTR_ENTRY("name", OnName) 63 | XMLATTR_ENTRY_EX("arrayType", WSDL_NAMESPACEA, OnArrayType) 64 | XMLATTR_ENTRY("type", OnType) 65 | XMLATTR_ENTRY("use", OnUse) 66 | XMLATTR_ENTRY("value", OnValue) 67 | XMLATTR_ENTRY("id", OnID) 68 | END_XMLATTR_MAP() 69 | 70 | TAG_METHOD_DECL(OnAnnotation); 71 | TAG_METHOD_DECL(OnSimpleType); 72 | 73 | ATTR_METHOD_DECL(OnForm); 74 | ATTR_METHOD_DECL(OnRef); 75 | ATTR_METHOD_DECL(OnArrayType); 76 | ATTR_METHOD_DECL(OnName); 77 | ATTR_METHOD_DECL(OnType); 78 | ATTR_METHOD_DECL(OnUse); 79 | ATTR_METHOD_DECL(OnValue); 80 | ATTR_METHOD_DECL(OnID); 81 | }; -------------------------------------------------------------------------------- /source/SProxy/ComplexType.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // ComplexType.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | #include "Attribute.h" 9 | #include "ComplexType.h" 10 | #include "Element.h" 11 | #include "Content.h" 12 | 13 | CElement * CComplexType::AddElement(CElement * p) 14 | { 15 | CAutoPtr spOut; 16 | if (p == NULL) 17 | { 18 | spOut.Attach( new CElement ); 19 | p = spOut; 20 | } 21 | 22 | if (p != NULL) 23 | { 24 | if (m_elements.AddTail(p) != NULL) 25 | { 26 | spOut.Detach(); 27 | return p; 28 | } 29 | } 30 | 31 | return NULL; 32 | } 33 | 34 | CAttribute * CComplexType::AddAttribute(CAttribute * p) 35 | { 36 | CAutoPtr spOut; 37 | if (p == NULL) 38 | { 39 | spOut.Attach( new CAttribute ); 40 | p = spOut; 41 | } 42 | 43 | if (p != NULL) 44 | { 45 | if (m_attributes.AddTail(p) != NULL) 46 | { 47 | spOut.Detach(); 48 | return p; 49 | } 50 | } 51 | 52 | return NULL; 53 | } 54 | 55 | CContent * CComplexType::AddContent(CContent *pContent) 56 | { 57 | if (pContent == NULL) 58 | { 59 | pContent = new CContent; 60 | } 61 | delete m_pContent; 62 | m_pContent = pContent; 63 | 64 | return m_pContent; 65 | } 66 | 67 | CComplexType::~CComplexType() 68 | { 69 | delete m_pContent; 70 | } -------------------------------------------------------------------------------- /source/SProxy/ComplexTypeParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // ComplexTypeParser.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Parser.h" 11 | #include "Emit.h" 12 | #include "resource.h" 13 | 14 | class CComplexType; 15 | 16 | class CComplexTypeParser : public CParserBase 17 | { 18 | private: 19 | 20 | CComplexType * m_pComplexType; 21 | 22 | public: 23 | 24 | inline CComplexTypeParser(ISAXXMLReader *pReader, CParserBase *pParent, DWORD dwLevel, CComplexType * pComplexType = NULL) 25 | :CParserBase(pReader, pParent, dwLevel), m_pComplexType(pComplexType) 26 | { 27 | } 28 | 29 | inline CComplexType * GetComplexType() 30 | { 31 | return m_pComplexType; 32 | } 33 | 34 | inline void SetComplexType(CComplexType * pComplexType) 35 | { 36 | m_pComplexType = pComplexType; 37 | } 38 | 39 | inline void MarkUnsupported(const wchar_t *wszQName, int cchQName) 40 | { 41 | #ifdef _DEBUG 42 | int nLine; 43 | int nCol; 44 | GetLocator()->getLineNumber(&nLine); 45 | GetLocator()->getColumnNumber(&nCol); 46 | ATLTRACE( _T("%sUnsupported tag@(%d, %d) : %.*ws -- skipping element\n"), GetTabs(GetLevel()), 47 | nLine, nCol, 48 | cchQName, wszQName ); 49 | #endif 50 | } 51 | 52 | /* 53 | annotation, length, enumeration, pattern, scale, period, duration, 54 | maxLength, precision, minInclusive, minExclusive, maxInclusive, 55 | maxExclusive, minLength, encoding, element, group, all, choice, 56 | sequence, attribute, attributeGroup, anyAttribute 57 | */ 58 | BEGIN_XMLTAG_MAP() 59 | XMLTAG_ENTRY_EX("element", XSD_NAMESPACEA, OnElement) 60 | XMLTAG_ENTRY_EX("all", XSD_NAMESPACEA, OnAll) 61 | XMLTAG_ENTRY_EX("choice", XSD_NAMESPACEA, OnChoice) 62 | XMLTAG_ENTRY_EX("annotation", XSD_NAMESPACEA, OnAnnotation) 63 | XMLTAG_ENTRY_EX("length", XSD_NAMESPACEA, OnLength) 64 | XMLTAG_ENTRY_EX("enumeration", XSD_NAMESPACEA, OnEnumeration) 65 | XMLTAG_ENTRY_EX("pattern", XSD_NAMESPACEA, OnPattern) 66 | XMLTAG_ENTRY_EX("scale", XSD_NAMESPACEA, OnScale) 67 | XMLTAG_ENTRY_EX("period", XSD_NAMESPACEA, OnPeriod) 68 | XMLTAG_ENTRY_EX("duration", XSD_NAMESPACEA, OnDuration) 69 | XMLTAG_ENTRY_EX("maxLength", XSD_NAMESPACEA, OnMaxLength) 70 | XMLTAG_ENTRY_EX("precision", XSD_NAMESPACEA, OnPrecision) 71 | XMLTAG_ENTRY_EX("minInclusive", XSD_NAMESPACEA, OnMinInclusive) 72 | XMLTAG_ENTRY_EX("minExclusive", XSD_NAMESPACEA, OnMinExclusive) 73 | XMLTAG_ENTRY_EX("maxInclusive", XSD_NAMESPACEA, OnMaxInclusive) 74 | XMLTAG_ENTRY_EX("maxExclusive", XSD_NAMESPACEA, OnMaxExclusive) 75 | XMLTAG_ENTRY_EX("minLength", XSD_NAMESPACEA, OnMinLength) 76 | XMLTAG_ENTRY_EX("encoding", XSD_NAMESPACEA, OnEncoding) 77 | XMLTAG_ENTRY_EX("group", XSD_NAMESPACEA, OnGroup) 78 | XMLTAG_ENTRY_EX("sequence", XSD_NAMESPACEA, OnSequence) 79 | XMLTAG_ENTRY_EX("attribute", XSD_NAMESPACEA, OnAttribute) 80 | XMLTAG_ENTRY_EX("attributeGroup", XSD_NAMESPACEA, OnAttributeGroup) 81 | XMLTAG_ENTRY_EX("anyAttribute", XSD_NAMESPACEA, OnAnyAttribute) 82 | 83 | // REVIEW: new ones 84 | XMLTAG_ENTRY_EX("complexContent", XSD_NAMESPACEA, OnComplexContent) 85 | XMLTAG_ENTRY_EX("simpleContent", XSD_NAMESPACEA, OnSimpleContent) 86 | XMLTAG_ENTRY_EX("any", XSD_NAMESPACEA, OnAny) 87 | END_XMLTAG_MAP() 88 | 89 | 90 | /* 91 | 101 | */ 102 | BEGIN_XMLATTR_MAP() 103 | XMLATTR_ENTRY("name", OnName) 104 | XMLATTR_ENTRY("id", OnID) 105 | XMLATTR_ENTRY("abstract", OnAbstract) 106 | XMLATTR_ENTRY("base", OnBase) 107 | XMLATTR_ENTRY("block", OnBlock) 108 | XMLATTR_ENTRY("content", OnContent) 109 | XMLATTR_ENTRY("derivedBy", OnDerivedBy) 110 | XMLATTR_ENTRY("final", OnFinal) 111 | END_XMLATTR_MAP() 112 | 113 | TAG_METHOD_DECL(OnElement); 114 | TAG_METHOD_DECL(OnAll); 115 | TAG_METHOD_DECL(OnChoice); 116 | TAG_METHOD_DECL(OnAnnotation); 117 | TAG_METHOD_DECL(OnLength); 118 | TAG_METHOD_DECL(OnPattern); 119 | TAG_METHOD_DECL(OnEnumeration); 120 | TAG_METHOD_DECL(OnScale); 121 | TAG_METHOD_DECL(OnPeriod); 122 | TAG_METHOD_DECL(OnDuration); 123 | TAG_METHOD_DECL(OnMaxLength); 124 | TAG_METHOD_DECL(OnPrecision); 125 | TAG_METHOD_DECL(OnMinInclusive); 126 | TAG_METHOD_DECL(OnMinExclusive); 127 | TAG_METHOD_DECL(OnMaxInclusive); 128 | TAG_METHOD_DECL(OnMaxExclusive); 129 | TAG_METHOD_DECL(OnMinLength); 130 | TAG_METHOD_DECL(OnEncoding); 131 | TAG_METHOD_DECL(OnGroup); 132 | TAG_METHOD_DECL(OnSequence); 133 | TAG_METHOD_DECL(OnAttribute); 134 | TAG_METHOD_DECL(OnAttributeGroup); 135 | TAG_METHOD_DECL(OnAnyAttribute); 136 | 137 | // new ones 138 | TAG_METHOD_DECL(OnComplexContent); 139 | TAG_METHOD_DECL(OnSimpleContent); 140 | TAG_METHOD_DECL(OnAny); 141 | 142 | 143 | ATTR_METHOD_DECL(OnName); 144 | ATTR_METHOD_DECL(OnID); 145 | ATTR_METHOD_DECL(OnAbstract); 146 | ATTR_METHOD_DECL(OnBase); 147 | ATTR_METHOD_DECL(OnBlock); 148 | ATTR_METHOD_DECL(OnContent); 149 | ATTR_METHOD_DECL(OnDerivedBy); 150 | ATTR_METHOD_DECL(OnFinal); 151 | 152 | HRESULT __stdcall startPrefixMapping( 153 | const wchar_t *wszPrefix, 154 | int cchPrefix, 155 | const wchar_t *wszUri, 156 | int cchUri); 157 | }; -------------------------------------------------------------------------------- /source/SProxy/Content.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Content.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Content.h" 11 | #include "Attribute.h" 12 | #include "Element.h" // required for CComplexType::m_elements.RemoveAll() 13 | #include "ComplexType.h" 14 | 15 | CComplexType * CContent::AddType(CComplexType *pType) 16 | { 17 | if (pType == NULL) 18 | { 19 | pType = new CComplexType; 20 | } 21 | delete m_pType; 22 | m_pType = pType; 23 | 24 | return m_pType; 25 | } 26 | 27 | CComplexType * CContent::GetType() 28 | { 29 | return m_pType; 30 | } 31 | 32 | CContent::~CContent() 33 | { 34 | delete m_pType; 35 | } -------------------------------------------------------------------------------- /source/SProxy/Content.h: -------------------------------------------------------------------------------- 1 | // 2 | // Content.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | // CContent represents the complexContent and the simpleContent 8 | 9 | #pragma once 10 | 11 | #include "stdafx.h" 12 | #include "XSDElement.h" 13 | #include "QName.h" 14 | #include "Util.h" 15 | 16 | class CComplexType; 17 | 18 | class CContent : public CXSDElement 19 | { 20 | private: 21 | 22 | // restriction/extension 23 | CComplexType * m_pType; 24 | 25 | BOOL m_bMixed; 26 | CStringW m_strID; 27 | 28 | protected: 29 | 30 | public: 31 | 32 | CContent() 33 | :m_pType(NULL), m_bMixed(FALSE) 34 | { 35 | } 36 | 37 | CComplexType * AddType(CComplexType *pContent = NULL); 38 | 39 | CComplexType * GetType(); 40 | 41 | ~CContent(); 42 | 43 | inline HRESULT SetID(const wchar_t *wsz, int cch) 44 | { 45 | m_strID.SetString(wsz, cch); 46 | return S_OK; 47 | } 48 | 49 | inline HRESULT SetID(const CStringW& strID) 50 | { 51 | m_strID = strID; 52 | return S_OK; 53 | } 54 | 55 | inline HRESULT SetMixed(const wchar_t *wszValue, int cchValue) 56 | { 57 | bool bVal; 58 | HRESULT hr = GetBooleanValue(&bVal, wszValue, cchValue); 59 | if (SUCCEEDED(hr)) 60 | { 61 | m_bMixed = (bVal == true) ? TRUE : FALSE; 62 | } 63 | 64 | // unknown string 65 | return hr; 66 | } 67 | 68 | inline HRESULT SetMixed(BOOL bMixed) 69 | { 70 | m_bMixed = bMixed; 71 | } 72 | 73 | inline BOOL GetMixed() 74 | { 75 | return m_bMixed; 76 | } 77 | }; // class CContent -------------------------------------------------------------------------------- /source/SProxy/ContentParser.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // ContentParser.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | #include "ContentParser.h" 9 | #include "Content.h" 10 | #include "Attribute.h" 11 | #include "ComplexTypeParser.h" 12 | #include "Element.h" 13 | #include "ComplexType.h" 14 | 15 | // CContentParser parses the simpleContent tag and the complexContent tag 16 | 17 | TAG_METHOD_IMPL(CContentParser, OnAnnotation) 18 | { 19 | TRACE_PARSE_ENTRY(); 20 | 21 | return SkipElement(); 22 | } 23 | 24 | TAG_METHOD_IMPL(CContentParser, OnRestriction) 25 | { 26 | TRACE_PARSE_ENTRY(); 27 | 28 | CContent *pCurr = GetContent(); 29 | if (pCurr != NULL) 30 | { 31 | CComplexType * pElem = pCurr->AddType(); 32 | if (pElem != NULL) 33 | { 34 | pElem->SetElementType(XSD_RESTRICTION); 35 | SetXSDElementInfo(pElem, pCurr, GetLocator()); 36 | 37 | CAutoPtr p( new CComplexTypeParser(GetReader(), this, GetLevel(), pElem) ); 38 | if (p != NULL) 39 | { 40 | if (g_ParserList.AddHead(p) != NULL) 41 | { 42 | return p.Detach()->GetAttributes(pAttributes); 43 | } 44 | } 45 | } 46 | } 47 | 48 | EmitErrorHr(E_OUTOFMEMORY); 49 | 50 | return E_FAIL; 51 | } 52 | 53 | TAG_METHOD_IMPL(CContentParser, OnExtension) 54 | { 55 | TRACE_PARSE_ENTRY(); 56 | 57 | int nLine = 0; 58 | int nCol = 0; 59 | GetLocator()->getLineNumber(&nLine); 60 | GetLocator()->getColumnNumber(&nCol); 61 | 62 | CContent *pCurr = GetContent(); 63 | if (pCurr != NULL) 64 | { 65 | EmitFileError(IDS_SDL_BASE_EXTENSION, 66 | (LPCWSTR) pCurr->GetParentDocument()->GetDocumentUri(), 67 | nLine, nCol, 0); 68 | } 69 | 70 | return E_FAIL; 71 | } 72 | 73 | ATTR_METHOD_IMPL(CContentParser, OnMixed) 74 | { 75 | TRACE_PARSE_ENTRY(); 76 | 77 | CContent *pCurr = GetContent(); 78 | if (pCurr != NULL) 79 | { 80 | if (SUCCEEDED(pCurr->SetMixed(wszValue, cchValue))) 81 | { 82 | return S_OK; 83 | } 84 | EmitInvalidValue("mixed", wszValue); 85 | } 86 | 87 | EmitErrorHr(E_OUTOFMEMORY); 88 | 89 | return E_FAIL; 90 | } 91 | 92 | ATTR_METHOD_IMPL(CContentParser, OnID) 93 | { 94 | TRACE_PARSE_ENTRY(); 95 | 96 | CContent *pCurr = GetContent(); 97 | if (pCurr != NULL) 98 | { 99 | return pCurr->SetID(wszValue, cchValue); 100 | } 101 | 102 | EmitErrorHr(E_OUTOFMEMORY); 103 | return E_FAIL; 104 | } 105 | -------------------------------------------------------------------------------- /source/SProxy/ContentParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // ContentParser.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Parser.h" 11 | #include "Emit.h" 12 | #include "resource.h" 13 | 14 | // CContentParser parses the simpleContent tag and the complexContent tag 15 | 16 | class CContent; 17 | 18 | class CContentParser : public CParserBase 19 | { 20 | private: 21 | 22 | CContent *m_pContent; 23 | 24 | public: 25 | 26 | inline CContentParser(ISAXXMLReader *pReader, CParserBase *pParent, DWORD dwLevel, CContent *pContent = NULL) 27 | :CParserBase(pReader, pParent, dwLevel), m_pContent(pContent) 28 | { 29 | } 30 | 31 | inline CContent * GetContent() 32 | { 33 | return m_pContent; 34 | } 35 | 36 | inline CContent * SetContent(CContent *pContent) 37 | { 38 | m_pContent = pContent; 39 | } 40 | 41 | /* 42 | 46 | Content: (annotation? , (restriction | extension)) 47 | 48 | 49 | 52 | Content: (annotation? , (restriction | extension)) 53 | 54 | */ 55 | BEGIN_XMLTAG_MAP() 56 | XMLTAG_ENTRY_EX("annotation", XSD_NAMESPACEA, OnAnnotation) 57 | XMLTAG_ENTRY_EX("restriction", XSD_NAMESPACEA, OnRestriction) 58 | XMLTAG_ENTRY_EX("extension", XSD_NAMESPACEA, OnExtension) 59 | END_XMLTAG_MAP() 60 | 61 | BEGIN_XMLATTR_MAP() 62 | XMLATTR_ENTRY("mixed", OnMixed) 63 | XMLATTR_ENTRY("id", OnID) 64 | END_XMLATTR_MAP() 65 | 66 | TAG_METHOD_DECL(OnAnnotation); 67 | TAG_METHOD_DECL(OnRestriction); 68 | TAG_METHOD_DECL(OnExtension); 69 | 70 | ATTR_METHOD_DECL(OnMixed); 71 | ATTR_METHOD_DECL(OnID); 72 | }; 73 | 74 | typedef CContentParser CComplexContentParser; 75 | typedef CContentParser CSimpleContentParser; -------------------------------------------------------------------------------- /source/SProxy/DiscoMapDocument.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | #include "stdafx.h" 5 | #include "DiscoMapDocument.h" 6 | 7 | CDiscoMapDocument::CDiscoMapDocument(void) 8 | { 9 | SetDocumentType(DMDOC); 10 | } 11 | 12 | CDiscoMapDocument::~CDiscoMapDocument(void) 13 | { 14 | } 15 | 16 | void CDiscoMapDocument::SetWSDLFile(const CStringW & wsdlFile) 17 | { 18 | CPathW cp; 19 | cp.Combine(GetPath(),wsdlFile); 20 | 21 | m_wsdlFile = LPCWSTR(cp); 22 | } 23 | 24 | void CDiscoMapDocument::AddSchema(const CStringW & url, const CStringW & filename) 25 | { 26 | CPathW cp; 27 | cp.Combine(GetPath(),filename); 28 | 29 | m_schemaMap.SetAt(url,LPCWSTR(cp)); 30 | } 31 | 32 | CStringW & CDiscoMapDocument::GetWSDLFile(void) 33 | { 34 | return m_wsdlFile; 35 | } 36 | 37 | CStringW & CDiscoMapDocument::GetValue(const CStringW & value) 38 | { 39 | return m_schemaMap[value]; 40 | } 41 | 42 | CStringW & CDiscoMapDocument::GetPath(void) 43 | { 44 | if(m_strPath.IsEmpty()) 45 | { 46 | CStringW strDoc(GetDocumentUri()); 47 | 48 | wchar_t * pBuf = m_strPath.GetBuffer(MAX_PATH) ; 49 | wchar_t * p = NULL ; 50 | int nLength=GetFullPathNameW(LPCWSTR(strDoc),MAX_PATH,pBuf,&p); 51 | ATLENSURE(nLength!=0 && nLength<=MAX_PATH); 52 | ATLENSURE(p); 53 | *p = 0; 54 | m_strPath.ReleaseBuffer(); 55 | 56 | } 57 | return m_strPath; 58 | } 59 | -------------------------------------------------------------------------------- /source/SProxy/DiscoMapDocument.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | #pragma once 5 | #include "xmldocument.h" 6 | 7 | class CDiscoMapDocument : 8 | public CXMLDocument 9 | { 10 | public: 11 | CDiscoMapDocument(void); 12 | ~CDiscoMapDocument(void); 13 | private: 14 | typedef CAtlMap SCHEMAMAP; 15 | 16 | public: 17 | void SetWSDLFile(const CStringW & wsdlFile); 18 | private: 19 | CStringW m_wsdlFile; 20 | SCHEMAMAP m_schemaMap; 21 | public: 22 | void AddSchema(const CStringW & url, const CStringW & filename); 23 | CStringW & GetWSDLFile(void); 24 | CStringW & GetValue(const CStringW & value); 25 | private: 26 | CStringW m_strPath; 27 | protected: 28 | CStringW & GetPath(void); 29 | }; 30 | -------------------------------------------------------------------------------- /source/SProxy/DiscoMapParser.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | #include "stdafx.h" 5 | #include "util.h" 6 | #include "DiscoMapparser.h" 7 | #include "DiscoMapDocument.h" 8 | CDiscoMapParser::CDiscoMapParser(void) 9 | :m_pDocument(NULL) 10 | { 11 | } 12 | 13 | CDiscoMapParser::~CDiscoMapParser(void) 14 | { 15 | } 16 | 17 | CDiscoMapParser::CDiscoMapParser(ISAXXMLReader * pReader, CParserBase * pParent, DWORD dwLevel) 18 | :CParserBase(pReader, pParent, dwLevel), m_pDocument(NULL) 19 | { 20 | } 21 | 22 | CDiscoMapDocument * CDiscoMapParser::CreateDiscoMapDocument(void) 23 | { 24 | m_pDocument.Attach( new CDiscoMapDocument ); 25 | return m_pDocument; 26 | } 27 | 28 | 29 | TAG_METHOD_IMPL(CDiscoMapParser, OnDiscoveryClientResultsFile) 30 | { 31 | TRACE_PARSE_ENTRY(); 32 | return S_OK; 33 | } 34 | 35 | TAG_METHOD_IMPL(CDiscoMapParser, OnResults) 36 | { 37 | TRACE_PARSE_ENTRY(); 38 | return S_OK; 39 | } 40 | 41 | TAG_METHOD_IMPL(CDiscoMapParser, OnDiscoveryClientResult) 42 | { 43 | TRACE_PARSE_ENTRY(); 44 | 45 | CStringW strRT; 46 | HRESULT hr = GetAttribute(pAttributes, L"referenceType", sizeof("referenceType")-1, strRT); 47 | 48 | if(FAILED(hr)) 49 | return hr; 50 | 51 | CDiscoMapDocument * pDoc = GetDiscoMapDocument(); 52 | 53 | if(strRT == "System.Web.Services.Discovery.SchemaReference") 54 | { 55 | CStringW strURL; 56 | hr = GetAttribute(pAttributes, L"url", sizeof("url")-1, strURL); 57 | if(FAILED(hr)) 58 | return hr; 59 | 60 | CStringW strFileName; 61 | hr = GetAttribute(pAttributes, L"filename", sizeof("filename")-1, strFileName); 62 | if(FAILED(hr)) 63 | return hr; 64 | 65 | pDoc->AddSchema(strURL,strFileName); 66 | 67 | return S_OK; 68 | } 69 | 70 | if(strRT == "System.Web.Services.Discovery.ContractReference") 71 | { 72 | CStringW strWSDLFile; 73 | hr = GetAttribute(pAttributes, L"filename", sizeof("filename")-1, strWSDLFile); 74 | if(FAILED(hr)) 75 | return hr; 76 | 77 | pDoc->SetWSDLFile(strWSDLFile); 78 | 79 | } 80 | 81 | return S_OK; 82 | } 83 | -------------------------------------------------------------------------------- /source/SProxy/DiscoMapParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | #pragma once 5 | #include "parser.h" 6 | 7 | class CDiscoMapDocument; 8 | 9 | class CDiscoMapParser : 10 | public CParserBase 11 | { 12 | public: 13 | CDiscoMapParser(void); 14 | ~CDiscoMapParser(void); 15 | 16 | BEGIN_XMLTAG_MAP() 17 | XMLTAG_ENTRY( "DiscoveryClientResultsFile", OnDiscoveryClientResultsFile ) 18 | XMLTAG_ENTRY( "Results", OnResults) 19 | XMLTAG_ENTRY( "DiscoveryClientResult", OnDiscoveryClientResult ) 20 | END_XMLTAG_MAP() 21 | 22 | TAG_METHOD_DECL( OnDiscoveryClientResultsFile ); 23 | TAG_METHOD_DECL( OnResults); 24 | TAG_METHOD_DECL( OnDiscoveryClientResult ); 25 | 26 | private: 27 | CAutoPtr m_pDocument; 28 | public: 29 | CDiscoMapParser(ISAXXMLReader * pReader, CParserBase * pParent, DWORD dwLevel); 30 | 31 | CDiscoMapDocument * GetDiscoMapDocument(bool bReleaseOwnership = FALSE) 32 | { 33 | if (m_pDocument == NULL) 34 | { 35 | CreateDiscoMapDocument(); 36 | } 37 | 38 | if (bReleaseOwnership != FALSE) 39 | { 40 | return m_pDocument.Detach(); 41 | } 42 | return m_pDocument; 43 | } 44 | CDiscoMapDocument * CreateDiscoMapDocument(void); 45 | }; 46 | -------------------------------------------------------------------------------- /source/SProxy/Element.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Element.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | #include "Element.h" 9 | #include "ComplexType.h" 10 | #include "SimpleType.h" 11 | #include "Schema.h" 12 | #include "Attribute.h" 13 | #include "Content.h" 14 | 15 | CComplexType * CElement::AddComplexType(CComplexType * p) 16 | { 17 | CAutoPtr spOut; 18 | if (p== NULL) 19 | { 20 | spOut.Attach( new CComplexType ); 21 | p = spOut; 22 | } 23 | 24 | if (p != NULL) 25 | { 26 | if (m_elements.AddTail(p) != NULL) 27 | { 28 | spOut.Detach(); 29 | return p; 30 | } 31 | } 32 | 33 | return NULL; 34 | } 35 | 36 | CSimpleType * CElement::AddSimpleType(CSimpleType * p) 37 | { 38 | CAutoPtr spOut; 39 | if (p== NULL) 40 | { 41 | spOut.Attach( new CSimpleType ); 42 | p = spOut; 43 | } 44 | 45 | if (p != NULL) 46 | { 47 | if (m_elements.AddTail(p) != NULL) 48 | { 49 | spOut.Detach(); 50 | return p; 51 | } 52 | } 53 | 54 | return NULL; 55 | } 56 | 57 | 58 | CXSDElement * CElement::GetType() 59 | { 60 | CXSDElement *pRet = NULL; 61 | if (m_type.GetName().GetLength()) 62 | { 63 | CSchema *pSchema = GetParentSchema(); 64 | if (pSchema != NULL) 65 | { 66 | CStringW strUri; 67 | if (SUCCEEDED(/*pSchema->*/GetNamespaceUri(m_type.GetPrefix(), strUri))) 68 | { 69 | pRet = pSchema->GetNamedItem(strUri, m_type.GetName()); 70 | } 71 | } 72 | } 73 | 74 | // 75 | // TODO: appropriate errors 76 | // 77 | 78 | return pRet; 79 | } 80 | 81 | const wchar_t * CElement::GetTargetNamespace() 82 | { 83 | if (m_type.GetName().GetLength()) 84 | { 85 | // CSchema *pSchema = GetParentSchema(); 86 | // if (pSchema != NULL) 87 | // { 88 | CStringW strUri; 89 | if (SUCCEEDED(/*pSchema->*/GetNamespaceUri(m_type.GetPrefix(), strUri))) 90 | { 91 | return strUri; 92 | } 93 | // } 94 | } 95 | 96 | EmitFileError(IDS_SDL_UNRESOLVED_NAMESPACE, const_cast(this), 0, m_type.GetPrefix()); 97 | 98 | return NULL; 99 | } -------------------------------------------------------------------------------- /source/SProxy/Element.h: -------------------------------------------------------------------------------- 1 | // 2 | // Element.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "XSDElement.h" 11 | #include "QName.h" 12 | 13 | class CComplexType; 14 | class CSimpleType; 15 | 16 | #define MAXOCCURS_UNBOUNDED -2 17 | 18 | class CElement : public CXSDElement 19 | { 20 | private: 21 | 22 | CAtlPtrList m_elements; 23 | CStringW m_strName; 24 | CStringW m_strID; 25 | CQName m_type; 26 | CQName m_ref; 27 | int m_nMinOccurs; 28 | int m_nMaxOccurs; 29 | BOOL m_bNullable; 30 | CStringW m_strArrayType; 31 | CStringW m_strSizeIs; 32 | 33 | public: 34 | 35 | CElement() 36 | :m_nMinOccurs(-1), m_nMaxOccurs(-1), m_bNullable(FALSE) 37 | { 38 | SetElementType(XSD_ELEMENT); 39 | } 40 | 41 | CComplexType * AddComplexType(CComplexType * pComplexType = NULL); 42 | CSimpleType * AddSimpleType(CSimpleType * pSimpleType = NULL); 43 | CXSDElement * GetType(); 44 | const wchar_t * GetTargetNamespace(); 45 | 46 | inline POSITION GetFirstElement() 47 | { 48 | return m_elements.GetHeadPosition(); 49 | } 50 | 51 | inline CXSDElement * GetNextElement(POSITION& pos) 52 | { 53 | return m_elements.GetNext(pos); 54 | } 55 | 56 | inline size_t GetNumChildren() 57 | { 58 | return m_elements.GetCount(); 59 | } 60 | 61 | inline HRESULT SetName(const wchar_t *wszName, int cchName) 62 | { 63 | if (!wszName) 64 | { 65 | return E_FAIL; 66 | } 67 | 68 | m_strName.SetString(wszName, cchName); 69 | 70 | return S_OK; 71 | } 72 | 73 | inline HRESULT SetName(const CStringW& strName) 74 | { 75 | m_strName = strName; 76 | 77 | return S_OK; 78 | } 79 | 80 | inline const CStringW& GetName() 81 | { 82 | return m_strName; 83 | } 84 | 85 | inline HRESULT SetID(const wchar_t *wszID, int cchID) 86 | { 87 | if (!wszID) 88 | { 89 | return E_FAIL; 90 | } 91 | 92 | m_strID.SetString(wszID, cchID); 93 | 94 | return S_OK; 95 | } 96 | 97 | inline HRESULT SetID(const CStringW& strID) 98 | { 99 | m_strID = strID; 100 | 101 | return S_OK; 102 | } 103 | 104 | inline const CStringW& GetID() 105 | { 106 | return m_strID; 107 | } 108 | 109 | inline HRESULT SetType(const CStringW& strQName) 110 | { 111 | m_type.SetQName(strQName); 112 | 113 | return S_OK; 114 | } 115 | 116 | inline HRESULT SetType(const CStringW& strPrefix, const CStringW& strName) 117 | { 118 | m_type.SetQName(strPrefix, strName); 119 | 120 | return S_OK; 121 | } 122 | 123 | inline HRESULT SetType(const wchar_t *wszQName, int cchQName) 124 | { 125 | m_type.SetQName(wszQName, cchQName); 126 | 127 | return S_OK; 128 | } 129 | 130 | inline CQName& GetTypeName() 131 | { 132 | return m_type; 133 | } 134 | 135 | inline HRESULT SetRef(const CStringW& strQName) 136 | { 137 | m_ref.SetQName(strQName); 138 | 139 | return S_OK; 140 | } 141 | 142 | inline HRESULT SetRef(const CStringW& strPrefix, const CStringW& strName) 143 | { 144 | m_ref.SetQName(strPrefix, strName); 145 | 146 | return S_OK; 147 | } 148 | 149 | inline HRESULT SetRef(const wchar_t *wszQName, int cchQName) 150 | { 151 | m_ref.SetQName(wszQName, cchQName); 152 | 153 | return S_OK; 154 | } 155 | 156 | inline const CQName& GetRefName() 157 | { 158 | return m_ref; 159 | } 160 | 161 | inline BOOL HasMinOccurs() 162 | { 163 | return (m_nMinOccurs != -1 ? TRUE : FALSE); 164 | } 165 | 166 | inline BOOL HasMaxOccurs() 167 | { 168 | return (m_nMaxOccurs != -1 ? TRUE : FALSE); 169 | } 170 | 171 | inline void SetMinOccurs(int nMinOccurs) 172 | { 173 | m_nMinOccurs = nMinOccurs; 174 | } 175 | 176 | inline int GetMinOccurs() 177 | { 178 | return m_nMinOccurs; 179 | } 180 | 181 | inline void SetMaxOccurs(int nMaxOccurs) 182 | { 183 | m_nMaxOccurs = nMaxOccurs; 184 | } 185 | 186 | inline int GetMaxOccurs() 187 | { 188 | return m_nMaxOccurs; 189 | } 190 | 191 | inline BOOL GetNullable() 192 | { 193 | return m_bNullable; 194 | } 195 | 196 | inline void SetNullable(BOOL bNullable) 197 | { 198 | m_bNullable = bNullable; 199 | } 200 | 201 | inline HRESULT SetArrayType(const wchar_t *wszArrayType, int cchArrayType) 202 | { 203 | if (!wszArrayType) 204 | { 205 | return E_FAIL; 206 | } 207 | 208 | m_strArrayType.SetString(wszArrayType, cchArrayType); 209 | 210 | return S_OK; 211 | } 212 | 213 | inline HRESULT SetArrayType(const CStringW& strArrayType) 214 | { 215 | m_strArrayType = strArrayType; 216 | 217 | return S_OK; 218 | } 219 | 220 | inline HRESULT SetSizeIs(const wchar_t *wszSizeIs, int cchSizeIs) 221 | { 222 | if (!wszSizeIs) 223 | { 224 | return E_FAIL; 225 | } 226 | 227 | m_strSizeIs.SetString(wszSizeIs, cchSizeIs); 228 | 229 | return S_OK; 230 | } 231 | 232 | inline HRESULT SetSizeIs(const CStringW& strSizeIs) 233 | { 234 | m_strSizeIs = strSizeIs; 235 | 236 | return S_OK; 237 | } 238 | 239 | inline const CStringW& GetSizeIs() 240 | { 241 | return m_strSizeIs; 242 | } 243 | 244 | inline const CStringW& GetArrayType() 245 | { 246 | return m_strArrayType; 247 | } 248 | }; -------------------------------------------------------------------------------- /source/SProxy/ElementParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // ElementParser.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Parser.h" 11 | #include "Emit.h" 12 | #include "resource.h" 13 | 14 | class CElement; 15 | 16 | class CElementParser : public CParserBase 17 | { 18 | private: 19 | 20 | CElement * m_pElem; 21 | 22 | public: 23 | 24 | inline CElementParser(ISAXXMLReader *pReader, CParserBase *pParent, DWORD dwLevel, CElement * pElem) 25 | :CParserBase(pReader, pParent, dwLevel), m_pElem(pElem) 26 | { 27 | } 28 | 29 | inline CElement * GetElement() 30 | { 31 | return m_pElem; 32 | } 33 | 34 | inline void SetElement(CElement * pElem) 35 | { 36 | m_pElem = pElem; 37 | } 38 | 39 | inline void MarkUnsupported(const wchar_t *wszQName, int cchQName) 40 | { 41 | #ifdef _DEBUG 42 | int nLine; 43 | int nCol; 44 | GetLocator()->getLineNumber(&nLine); 45 | GetLocator()->getColumnNumber(&nCol); 46 | ATLTRACE( _T("%sUnsupported tag@(%d, %d) : %.*ws -- skipping element\n"), GetTabs(GetLevel()), 47 | nLine, nCol, 48 | cchQName, wszQName ); 49 | #endif 50 | } 51 | 52 | /* 53 | simpleType, complexType, key, keyref, unique 54 | */ 55 | BEGIN_XMLTAG_MAP() 56 | XMLTAG_ENTRY_EX("simpleType", XSD_NAMESPACEA, OnSimpleType) 57 | XMLTAG_ENTRY_EX("complexType", XSD_NAMESPACEA, OnComplexType) 58 | XMLTAG_ENTRY_EX("key", XSD_NAMESPACEA, OnKey) 59 | XMLTAG_ENTRY_EX("keyRef", XSD_NAMESPACEA, OnKeyRef) 60 | XMLTAG_ENTRY_EX("unique", XSD_NAMESPACEA, OnUnique) 61 | END_XMLTAG_MAP() 62 | 63 | /* 64 | 81 | */ 82 | BEGIN_XMLATTR_MAP() 83 | XMLATTR_ENTRY("name", OnName) 84 | XMLATTR_ENTRY("type", OnType) 85 | XMLATTR_ENTRY("minOccurs", OnMinOccurs) 86 | XMLATTR_ENTRY("maxOccurs", OnMaxOccurs) 87 | XMLATTR_ENTRY("nillable", OnNillable) 88 | XMLATTR_ENTRY("ref", OnRef) 89 | XMLATTR_ENTRY("id", OnID) 90 | XMLATTR_ENTRY("abstract", OnAbstract) 91 | XMLATTR_ENTRY("block", OnBlock) 92 | XMLATTR_ENTRY("default", OnDefault) 93 | XMLATTR_ENTRY("equivClass", OnEquivClass) 94 | XMLATTR_ENTRY("final", OnFinal) 95 | XMLATTR_ENTRY("fixed", OnFixed) 96 | XMLATTR_ENTRY("form", OnForm) 97 | XMLATTR_ENTRY_EX("arrayType", SOAP_NAMESPACEA, OnArrayType) 98 | XMLATTR_ENTRY_EX("SizeIs", ATLS_NAMESPACEA, OnSizeIs) 99 | END_XMLATTR_MAP() 100 | 101 | TAG_METHOD_DECL(OnSimpleType); 102 | TAG_METHOD_DECL(OnComplexType); 103 | TAG_METHOD_DECL(OnKey); 104 | TAG_METHOD_DECL(OnKeyRef); 105 | TAG_METHOD_DECL(OnUnique); 106 | 107 | ATTR_METHOD_DECL(OnName); 108 | ATTR_METHOD_DECL(OnType); 109 | ATTR_METHOD_DECL(OnMinOccurs); 110 | ATTR_METHOD_DECL(OnMaxOccurs); 111 | ATTR_METHOD_DECL(OnNillable); 112 | ATTR_METHOD_DECL(OnRef); 113 | ATTR_METHOD_DECL(OnID); 114 | ATTR_METHOD_DECL(OnAbstract); 115 | ATTR_METHOD_DECL(OnBlock); 116 | ATTR_METHOD_DECL(OnDefault); 117 | ATTR_METHOD_DECL(OnEquivClass); 118 | ATTR_METHOD_DECL(OnFinal); 119 | ATTR_METHOD_DECL(OnFixed); 120 | ATTR_METHOD_DECL(OnForm); 121 | ATTR_METHOD_DECL(OnArrayType); 122 | ATTR_METHOD_DECL(OnSizeIs); 123 | 124 | HRESULT __stdcall startPrefixMapping( 125 | const wchar_t *wszPrefix, 126 | int cchPrefix, 127 | const wchar_t *wszUri, 128 | int cchUri); 129 | }; -------------------------------------------------------------------------------- /source/SProxy/Emit.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Emit.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | #include "Emit.h" 9 | #include "errordefs.h" 10 | #include "XMLDocument.h" 11 | 12 | void EmitError(UINT uID, ...) 13 | { 14 | va_list arglist; 15 | va_start(arglist, uID); 16 | g_Emit.EmitError(uID, arglist); 17 | va_end(arglist); 18 | } 19 | 20 | void EmitErrorHr(HRESULT hr) 21 | { 22 | g_Emit.EmitErrorHr(hr); 23 | } 24 | 25 | void EmitWarning(UINT uID, ...) 26 | { 27 | va_list arglist; 28 | va_start(arglist, uID); 29 | g_Emit.EmitWarning(uID, arglist); 30 | va_end(arglist); 31 | } 32 | 33 | void Emit(UINT uID, ...) 34 | { 35 | va_list arglist; 36 | va_start(arglist, uID); 37 | g_Emit.Emit(uID, arglist); 38 | va_end(arglist); 39 | } 40 | 41 | bool SetEmitWarnings(bool bWarn) 42 | { 43 | return g_Emit.SetEmitWarnings(bWarn); 44 | } 45 | 46 | void EmitCmdLineError(UINT uID, ...) 47 | { 48 | va_list arglist; 49 | va_start(arglist, uID); 50 | g_Emit.EmitCmdLineError(uID, arglist); 51 | va_end(arglist); 52 | } 53 | 54 | void EmitCmdLineWarning(UINT uID, ...) 55 | { 56 | va_list arglist; 57 | va_start(arglist, uID); 58 | g_Emit.EmitCmdLineWarning(uID, arglist); 59 | va_end(arglist); 60 | } 61 | 62 | void EmitFileWarning(UINT uID, LPCWSTR wszFile, int nLine, int nCol, UINT uIDExtra, ...) 63 | { 64 | va_list arglist; 65 | va_start(arglist, uIDExtra); 66 | g_Emit.EmitFileWarning(uID, wszFile, nLine, nCol, uIDExtra, arglist); 67 | va_end(arglist); 68 | } 69 | 70 | void EmitFileError(UINT uID, LPCWSTR wszFile, int nLine, int nCol, UINT uIDExtra, ...) 71 | { 72 | va_list arglist; 73 | va_start(arglist, uIDExtra); 74 | g_Emit.EmitFileError(uID, wszFile, nLine, nCol, uIDExtra, arglist); 75 | va_end(arglist); 76 | } 77 | 78 | void EmitFileWarning(UINT uID, CXMLElement *pElem, UINT uIDExtra, ...) 79 | { 80 | va_list arglist; 81 | va_start(arglist, uIDExtra); 82 | g_Emit.EmitFileWarning(uID, pElem->GetParentDocument()->GetDocumentUri(), pElem->GetLineNumber(), pElem->GetColumnNumber(), uIDExtra, arglist); 83 | va_end(arglist); 84 | } 85 | 86 | void EmitFileError(UINT uID, CXMLElement *pElem, UINT uIDExtra, ...) 87 | { 88 | va_list arglist; 89 | va_start(arglist, uIDExtra); 90 | g_Emit.EmitFileError(uID, pElem->GetParentDocument()->GetDocumentUri(), pElem->GetLineNumber(), pElem->GetColumnNumber(), uIDExtra, arglist); 91 | va_end(arglist); 92 | } -------------------------------------------------------------------------------- /source/SProxy/Emit.h: -------------------------------------------------------------------------------- 1 | // 2 | // Emit.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | class CXMLElement; 11 | 12 | void EmitError(UINT uID, ...); 13 | void EmitErrorHr(HRESULT hr); 14 | 15 | void EmitWarning(UINT uID, ...); 16 | 17 | void Emit(UINT uID, ...); 18 | 19 | bool SetEmitWarnings(bool bWarn); 20 | 21 | void EmitCmdLineError(UINT uID, ...); 22 | void EmitCmdLineWarning(UINT uID, ...); 23 | 24 | void EmitFileWarning(UINT uID, LPCWSTR wszFile, int nLine, int nCol, UINT uIDExtra, ...); 25 | void EmitFileError(UINT uID, LPCWSTR wszFile, int nLine, int nCol, UINT uIDExtra, ...); 26 | 27 | void EmitFileWarning(UINT uID, CXMLElement *pElem, UINT uIDExtra, ...); 28 | void EmitFileError(UINT uID, CXMLElement *pElem, UINT uIDExtra, ...); -------------------------------------------------------------------------------- /source/SProxy/ErrorHandler.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // ErrorHandler.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | #include "ErrorHandler.h" 9 | #include "Emit.h" 10 | #include "resource.h" 11 | #include "Parser.h" 12 | 13 | HRESULT __stdcall CErrorHandler::QueryInterface(REFIID riid, void **ppv) 14 | { 15 | if (!ppv) 16 | { 17 | return E_POINTER; 18 | } 19 | 20 | if (InlineIsEqualGUID(riid, __uuidof(ISAXErrorHandler)) || 21 | InlineIsEqualGUID(riid, __uuidof(IUnknown))) 22 | { 23 | *ppv = static_cast(this); 24 | return S_OK; 25 | } 26 | return E_NOINTERFACE; 27 | } 28 | 29 | ULONG __stdcall CErrorHandler::AddRef() 30 | { 31 | return 1; 32 | } 33 | 34 | ULONG __stdcall CErrorHandler::Release() 35 | { 36 | return 1; 37 | } 38 | 39 | HRESULT __stdcall CErrorHandler::error( 40 | ISAXLocator *pLocator, 41 | const wchar_t *wszErrorMessage, 42 | HRESULT hrErrorCode) 43 | { 44 | int nLine; 45 | int nCol; 46 | 47 | pLocator->getLineNumber(&nLine); 48 | pLocator->getColumnNumber(&nCol); 49 | ATLTRACE( _T("error@(%d, %d): %ws\n"), nLine, nCol, wszErrorMessage ); 50 | 51 | EmitFileError(IDS_SDL_PARSE_ERROR, m_wszLocation, nLine, nCol, IDS_SDL_PARSE, wszErrorMessage); 52 | g_ParserList.RemoveAll(); 53 | 54 | return E_FAIL; 55 | } 56 | 57 | HRESULT __stdcall CErrorHandler::fatalError( 58 | ISAXLocator *pLocator, 59 | const wchar_t *wszErrorMessage, 60 | HRESULT hrErrorCode) 61 | { 62 | int nLine; 63 | int nCol; 64 | 65 | pLocator->getLineNumber(&nLine); 66 | pLocator->getColumnNumber(&nCol); 67 | ATLTRACE( _T("fatalError@(%d, %d): %ws\n"), nLine, nCol, wszErrorMessage ); 68 | 69 | EmitFileError(IDS_SDL_PARSE_ERROR, m_wszLocation, nLine, nCol, IDS_SDL_PARSE, wszErrorMessage); 70 | g_ParserList.RemoveAll(); 71 | 72 | return E_FAIL; 73 | } 74 | 75 | HRESULT __stdcall CErrorHandler::ignorableWarning( 76 | ISAXLocator *pLocator, 77 | const wchar_t *wszErrorMessage, 78 | HRESULT hrErrorCode) 79 | { 80 | 81 | int nLine; 82 | int nCol; 83 | 84 | pLocator->getLineNumber(&nLine); 85 | pLocator->getColumnNumber(&nCol); 86 | 87 | ATLTRACE( _T("ignorableWarning@(%d, %d): %ws\n"), nLine, nCol, wszErrorMessage ); 88 | 89 | EmitFileWarning(IDS_SDL_PARSE_WARNING, m_wszLocation, nLine, nCol, IDS_SDL_PARSE, wszErrorMessage); 90 | 91 | return S_OK; 92 | } -------------------------------------------------------------------------------- /source/SProxy/ErrorHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // ErrorHandler.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | 11 | class CErrorHandler : public ISAXErrorHandler 12 | { 13 | private: 14 | const wchar_t * m_wszLocation; 15 | public: 16 | CErrorHandler() 17 | :m_wszLocation(NULL) 18 | { 19 | } 20 | 21 | void SetLocation(const wchar_t * wszLocation) 22 | { 23 | m_wszLocation = wszLocation; 24 | } 25 | 26 | virtual ~CErrorHandler() {} 27 | 28 | HRESULT __stdcall QueryInterface(REFIID riid, void **ppv); 29 | ULONG __stdcall AddRef(); 30 | ULONG __stdcall Release(); 31 | 32 | HRESULT __stdcall error( 33 | ISAXLocator *pLocator, 34 | const wchar_t *wszErrorMessage, 35 | HRESULT hrErrorCode); 36 | 37 | HRESULT __stdcall fatalError( 38 | ISAXLocator *pLocator, 39 | const wchar_t *wszErrorMessage, 40 | HRESULT hrErrorCode); 41 | 42 | HRESULT __stdcall ignorableWarning( 43 | ISAXLocator *pLocator, 44 | const wchar_t *wszErrorMessage, 45 | HRESULT hrErrorCode); 46 | }; 47 | -------------------------------------------------------------------------------- /source/SProxy/FacetMappingTable.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabegundy/atlserver/e2f585fc7e073f7195564be86717e3faec79346e/source/SProxy/FacetMappingTable.h -------------------------------------------------------------------------------- /source/SProxy/Namespaces.h: -------------------------------------------------------------------------------- 1 | // 2 | // Namespaces.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #define WSDL_NAMESPACEA "http://schemas.xmlsoap.org/wsdl/" 10 | #define WSDL_NAMESPACEW MAKEWIDESTR( WSDL_NAMESPACEA ) 11 | 12 | #define HTTP_NAMESPACEA "http://schemas.xmlsoap.org/wsdl/http/" 13 | #define HTTP_NAMESPACEW MAKEWIDESTR( HTTP_NAMESPACEA ) 14 | 15 | #define MIME_NAMESPACEA "http://schemas.xmlsoap.org/wsdl/mime/" 16 | #define MIME_NAMESPACEW MAKEWIDESTR( MIME_NAMESPACEA ) 17 | 18 | #define SOAP_NAMESPACEA "http://schemas.xmlsoap.org/wsdl/soap/" 19 | #define SOAP_NAMESPACEW MAKEWIDESTR( SOAP_NAMESPACEA ) 20 | 21 | #define XSI_NAMESPACEA "http://www.w3.org/2001/XMLSchema-instance" 22 | #define XSI_NAMESPACEW MAKEWIDESTR( XSI_NAMESPACEA ) 23 | 24 | #define XSD_NAMESPACEA "http://www.w3.org/2001/XMLSchema" 25 | #define XSD_NAMESPACEW MAKEWIDESTR( XSD_NAMESPACEA ) 26 | 27 | #define SOAP_ENCODINGSTYLEA "http://schemas.xmlsoap.org/soap/encoding/" 28 | #define SOAP_ENCODINGSTYLEW MAKEWIDESTR( SOAP_ENCODINGSTYLEA ) 29 | 30 | #define ATLS_NAMESPACEA "http://tempuri.org/vc/atl/server/" 31 | #define ATLS_NAMESPACEW MAKEWIDESTR( ATLS_NAMESPACEA ) 32 | 33 | #define FX_TYPES_NAMESPACEA "http://microsoft.com/wsdl/types/" 34 | #define FX_TYPES_NAMESPACEW MAKEWIDESTR( FX_TYPES_NAMESPACEA ) 35 | 36 | #define CLR_TYPES_NAMESPACEA "http://schemas.microsoft.com/clr/ns/System" 37 | #define CLR_TYPES_NAMESPACEW MAKEWIDESTR( CLR_TYPES_NAMESPACEA ) 38 | 39 | #if 0 40 | 41 | #define SUDS_NAMESPACEA "http://www.w3.org/2000/wsdl/suds" 42 | #define SUDS_NAMESPACEW MAKEWIDESTR( SUDS_NAMESPACEA ) 43 | 44 | #define STK_PREFERREDENCODING_NAMESPACEA "http://schemas.microsoft.com/soap-toolkit/wsdl-extension" 45 | #define STK_PREFERREDENCODING_NAMESPACEW MAKEWIDESTR( STK_PREFERREDENCODING_NAMESPACEA ) 46 | 47 | #endif -------------------------------------------------------------------------------- /source/SProxy/QName.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // QName.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | #include "QName.h" 9 | 10 | void CQName::CrackQName(const wchar_t *wszQName, int cchQName) 11 | { 12 | if (cchQName == -1) 13 | { 14 | cchQName = (int)wcslen(wszQName); 15 | } 16 | 17 | wchar_t * wszQNameTmp = (wchar_t *) wszQName; 18 | wchar_t * wszColon = wcschr(wszQNameTmp, L':'); 19 | if (wszColon && (wszColon-wszQNameTmp) <= cchQName) 20 | { 21 | m_strPrefix.SetString(wszQNameTmp, (int)(wszColon-wszQNameTmp)); 22 | m_strName.SetString(wszColon+1, (int)(cchQName-m_strPrefix.GetLength()-1)); 23 | } 24 | else 25 | { 26 | m_strName.SetString(wszQName, cchQName); 27 | } 28 | } 29 | 30 | CQName::CQName(const CStringW& strQName) 31 | { 32 | SetQName(strQName); 33 | } 34 | 35 | CQName::CQName(const CStringW& strPrefix, const CStringW& strName) 36 | :m_strPrefix(strPrefix), m_strName(strName) 37 | { 38 | } 39 | 40 | CQName::CQName(const wchar_t *wszQName, int cchQName) 41 | { 42 | SetQName(wszQName, cchQName); 43 | } 44 | 45 | void CQName::SetQName(const CStringW& strQName) 46 | { 47 | CrackQName((LPCWSTR) strQName, strQName.GetLength()); 48 | } 49 | 50 | void CQName::SetQName(const CStringW& strPrefix, const CStringW& strName) 51 | { 52 | m_strPrefix = strPrefix; 53 | m_strName = strName; 54 | } 55 | 56 | void CQName::SetQName(const wchar_t *wszQName, int cchQName) 57 | { 58 | CrackQName(wszQName, cchQName); 59 | } -------------------------------------------------------------------------------- /source/SProxy/QName.h: -------------------------------------------------------------------------------- 1 | // 2 | // QName.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | 11 | class CQName 12 | { 13 | private: 14 | 15 | CStringW m_strPrefix; 16 | CStringW m_strName; 17 | 18 | void CrackQName(const wchar_t *wszQName, int cchQName); 19 | 20 | public: 21 | 22 | CQName() 23 | { 24 | } 25 | 26 | CQName(const CStringW& strQName); 27 | CQName(const CStringW& strPrefix, const CStringW& strName); 28 | CQName(const wchar_t *wszQName, int cchQName); 29 | 30 | inline CQName(const CQName& that) 31 | { 32 | *this = that; 33 | } 34 | 35 | inline const CQName& operator=(const CQName& that) 36 | { 37 | if (this != &that) 38 | { 39 | m_strPrefix = that.m_strPrefix; 40 | m_strName = that.m_strName; 41 | } 42 | 43 | return *this; 44 | } 45 | 46 | void SetQName(const CStringW& strQName); 47 | void SetQName(const CStringW& strPrefix, const CStringW& strName); 48 | void SetQName(const wchar_t *wszQName, int cchQName); 49 | 50 | inline void SetPrefix(const CStringW& strPrefix) 51 | { 52 | m_strPrefix = strPrefix; 53 | } 54 | 55 | inline CStringW& GetPrefix() 56 | { 57 | return m_strPrefix; 58 | } 59 | 60 | inline CStringW& GetName() 61 | { 62 | return m_strName; 63 | } 64 | 65 | inline void SetName(const CStringW& strName) 66 | { 67 | m_strName = strName; 68 | } 69 | }; -------------------------------------------------------------------------------- /source/SProxy/ReadMe.txt: -------------------------------------------------------------------------------- 1 | This is placeholder for a readme file to Sproxy tool -------------------------------------------------------------------------------- /source/SProxy/Schema.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Schema.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | 9 | #include "Attribute.h" 10 | #include "Schema.h" 11 | #include "Element.h" 12 | #include "SimpleType.h" 13 | #include "ComplexType.h" 14 | #include "WSDLDocument.h" 15 | 16 | CComplexType * CSchema::AddComplexType(CComplexType * p) 17 | { 18 | if (p != NULL) 19 | { 20 | if (p->GetName().GetLength() != 0) 21 | { 22 | if (m_complexTypes.SetAt(p->GetName(), p) != NULL) 23 | { 24 | return p; 25 | } 26 | } 27 | } 28 | 29 | // 30 | // TODO: error 31 | // 32 | return NULL; 33 | } 34 | 35 | CSimpleType * CSchema::AddSimpleType(CSimpleType * p) 36 | { 37 | if (p != NULL) 38 | { 39 | if (p->GetName().GetLength() != 0) 40 | { 41 | if (m_simpleTypes.SetAt(p->GetName(), p) != NULL) 42 | { 43 | return p; 44 | } 45 | } 46 | } 47 | 48 | return NULL; 49 | } 50 | 51 | CElement * CSchema::AddElement(CElement * p) 52 | { 53 | if (p != NULL) 54 | { 55 | if (p->GetName().GetLength() != 0) 56 | { 57 | if (m_elements.SetAt(p->GetName(), p) != NULL) 58 | { 59 | return p; 60 | } 61 | } 62 | } 63 | 64 | return NULL; 65 | } 66 | 67 | CXSDElement * CSchema::GetNamedItemFromParent(const CStringW& strUri, const CStringW& strName) 68 | { 69 | CXSDElement *pRet = NULL; 70 | CXMLDocument *pParentDoc = GetParentDocument(); 71 | if ((pParentDoc != NULL) && (pParentDoc->GetDocumentType() == WSDLDOC)) 72 | { 73 | CWSDLDocument *pWSDLDocument = static_cast(pParentDoc); 74 | pRet = pWSDLDocument->GetComplexType(strName, strUri); 75 | if (pRet == NULL) 76 | { 77 | pRet = pWSDLDocument->GetSimpleType(strName, strUri); 78 | if (pRet == NULL) 79 | { 80 | pRet = pWSDLDocument->GetElement(strName, strUri); 81 | } 82 | } 83 | } 84 | return pRet; 85 | } -------------------------------------------------------------------------------- /source/SProxy/Schema.h: -------------------------------------------------------------------------------- 1 | // 2 | // Schema.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "XMLElement.h" 11 | #include "XSDElement.h" 12 | #include "ComplexType.h" 13 | #include "SimpleType.h" 14 | #include "Element.h" 15 | //#include "UnsupportedElement.h" 16 | 17 | #include "Emit.h" 18 | #include "resource.h" 19 | 20 | class CSchema : public CXSDElement 21 | { 22 | private: 23 | 24 | typedef CAtlPtrMap > COMPLEXTYPEMAP; 25 | typedef CAtlPtrMap > SIMPLETYPEMAP; 26 | typedef CAtlPtrMap > ELEMENTMAP; 27 | // typedef CAtlPtrMap > UNSUPPORTEDMAP; 28 | 29 | COMPLEXTYPEMAP m_complexTypes; 30 | SIMPLETYPEMAP m_simpleTypes; 31 | ELEMENTMAP m_elements; 32 | // UNSUPPORTEDMAP m_unsupportedTypes; 33 | 34 | CStringW m_strTargetNamespace; 35 | CStringW m_strName; 36 | CStringW m_strID; 37 | 38 | public: 39 | 40 | CComplexType * AddComplexType(CComplexType * p); 41 | CSimpleType * AddSimpleType(CSimpleType * p); 42 | CElement * AddElement(CElement * p); 43 | 44 | CXSDElement * GetNamedItemFromParent(const CStringW& strUri, const CStringW& strName); 45 | 46 | inline CXSDElement * GetNamedItem(const CStringW& strUri, const CStringW& strName) 47 | { 48 | CXSDElement *pRet = NULL; 49 | if (strUri.GetLength() == 0 || strUri == GetTargetNamespace()) 50 | { 51 | CStringW str; 52 | pRet = GetComplexType(str, strName); 53 | if (pRet == NULL) 54 | { 55 | pRet = GetSimpleType(str, strName); 56 | if (pRet == NULL) 57 | { 58 | pRet = GetElement(str, strName); 59 | // if (pRet == NULL) 60 | // { 61 | // pRet = GetUnsupportedElement(str, strName); 62 | // } 63 | } 64 | } 65 | } 66 | else 67 | { 68 | pRet = GetNamedItemFromParent(strUri, strName); 69 | } 70 | 71 | return pRet; 72 | } 73 | 74 | inline CComplexType * GetComplexType(const CStringW& strUri, const CStringW& strName) 75 | { 76 | if (strUri.GetLength() == 0 || strUri == GetTargetNamespace()) 77 | { 78 | const COMPLEXTYPEMAP::CPair *p = m_complexTypes.Lookup(strName); 79 | if (p != NULL) 80 | { 81 | return p->m_value; 82 | } 83 | } 84 | 85 | return NULL; 86 | } 87 | 88 | inline CSimpleType * GetSimpleType(const CStringW& strUri, const CStringW& strName) 89 | { 90 | if (strUri.GetLength() == 0 || strUri == GetTargetNamespace()) 91 | { 92 | const SIMPLETYPEMAP::CPair *p = m_simpleTypes.Lookup(strName); 93 | if (p != NULL) 94 | { 95 | return p->m_value; 96 | } 97 | } 98 | 99 | return NULL; 100 | } 101 | 102 | inline CElement * GetElement(const CStringW& strUri, const CStringW& strName) 103 | { 104 | if (strUri.GetLength() == 0 || strUri == GetTargetNamespace()) 105 | { 106 | const ELEMENTMAP::CPair *p = m_elements.Lookup(strName); 107 | if (p != NULL) 108 | { 109 | return p->m_value; 110 | } 111 | } 112 | 113 | return NULL; 114 | } 115 | 116 | // inline CUnsupportedElement * GetUnsupportedElement(const CStringW& strUri, const CStringW& strName) 117 | // { 118 | // if (strUri.GetLength() == 0 || strUri == GetTargetNamespace()) 119 | // { 120 | // const UNSUPPORTEDMAP::CPair *p = m_unsupportedTypes.Lookup(strName); 121 | // if (p != NULL) 122 | // { 123 | // return p->m_value; 124 | // } 125 | // } 126 | // 127 | // return NULL; 128 | // } 129 | 130 | inline HRESULT SetName(const wchar_t *wszName, int cchName) 131 | { 132 | if (!wszName) 133 | { 134 | return E_FAIL; 135 | } 136 | 137 | m_strName.SetString(wszName, cchName); 138 | 139 | return S_OK; 140 | } 141 | 142 | inline HRESULT SetName(const CStringW& strName) 143 | { 144 | m_strName = strName; 145 | 146 | return S_OK; 147 | } 148 | 149 | inline const CStringW& GetName() 150 | { 151 | return m_strName; 152 | } 153 | 154 | inline HRESULT SetTargetNamespace(const wchar_t *wszTargetNamespace, int cchTargetNamespace) 155 | { 156 | if (!wszTargetNamespace) 157 | { 158 | return E_FAIL; 159 | } 160 | 161 | m_strTargetNamespace.SetString(wszTargetNamespace, cchTargetNamespace); 162 | 163 | return S_OK; 164 | } 165 | 166 | inline HRESULT SetTargetNamespace(const CStringW& strTargetNamespace) 167 | { 168 | m_strTargetNamespace = strTargetNamespace; 169 | 170 | return S_OK; 171 | } 172 | 173 | inline const CStringW& GetTargetNamespace() 174 | { 175 | return m_strTargetNamespace; 176 | } 177 | 178 | inline HRESULT SetID(const wchar_t *wszID, int cchID) 179 | { 180 | if (!wszID) 181 | { 182 | return E_FAIL; 183 | } 184 | 185 | m_strID.SetString(wszID, cchID); 186 | 187 | return S_OK; 188 | } 189 | 190 | inline HRESULT SetID(const CStringW& strID) 191 | { 192 | m_strID = strID; 193 | 194 | return S_OK; 195 | } 196 | 197 | inline const CStringW& GetID() 198 | { 199 | return m_strID; 200 | } 201 | }; -------------------------------------------------------------------------------- /source/SProxy/SchemaDocument.h: -------------------------------------------------------------------------------- 1 | // 2 | // SchemaDocument.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Schema.h" 11 | 12 | class CSchemaDocument : public CXMLDocument 13 | { 14 | private: 15 | 16 | CSchema m_schema; 17 | 18 | public: 19 | 20 | inline CSchema * GetSchema() 21 | { 22 | return m_&schema; 23 | } 24 | }; -------------------------------------------------------------------------------- /source/SProxy/SchemaParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // SchemaParser.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Parser.h" 11 | #include "Emit.h" 12 | #include "resource.h" 13 | 14 | class CSchema; 15 | 16 | class CSchemaParser : public CParserBase 17 | { 18 | private: 19 | 20 | CSchema * m_pSchema; 21 | 22 | public: 23 | 24 | inline CSchemaParser(ISAXXMLReader *pReader, CParserBase *pParent, DWORD dwLevel, CSchema *pSchema = NULL) 25 | :CParserBase(pReader, pParent, dwLevel), m_pSchema(pSchema) 26 | { 27 | } 28 | 29 | inline CSchema * GetSchema() 30 | { 31 | return m_pSchema; 32 | } 33 | 34 | inline void SetSchema(CSchema *pSchema) 35 | { 36 | m_pSchema = pSchema; 37 | } 38 | 39 | void EmitNamedElementError(const char *szElem); 40 | 41 | inline void MarkUnsupported(const wchar_t *wszQName, int cchQName) 42 | { 43 | #ifdef _DEBUG 44 | int nLine; 45 | int nCol; 46 | GetLocator()->getLineNumber(&nLine); 47 | GetLocator()->getColumnNumber(&nCol); 48 | ATLTRACE( _T("%sUnsupported tag@(%d, %d) : %.*ws -- skipping element\n"), GetTabs(GetLevel()), 49 | nLine, nCol, 50 | cchQName, wszQName ); 51 | #endif 52 | } 53 | 54 | /* 55 | include, import, annotation, redefine 56 | attribute, attributeGroup, element, group, notation, simpleType, complexType 57 | */ 58 | 59 | BEGIN_XMLTAG_MAP() 60 | XMLTAG_ENTRY_EX("include", XSD_NAMESPACEA, OnInclude) 61 | XMLTAG_ENTRY_EX("import", XSD_NAMESPACEA, OnImport) 62 | XMLTAG_ENTRY_EX("annotation", XSD_NAMESPACEA, OnAnnotation) 63 | XMLTAG_ENTRY_EX("redefine", XSD_NAMESPACEA, OnRedefine) 64 | XMLTAG_ENTRY_EX("attribute", XSD_NAMESPACEA, OnAttribute) 65 | XMLTAG_ENTRY_EX("attributeGroup", XSD_NAMESPACEA, OnAttributeGroup) 66 | XMLTAG_ENTRY_EX("element", XSD_NAMESPACEA, OnElement) 67 | XMLTAG_ENTRY_EX("group", XSD_NAMESPACEA, OnGroup) 68 | XMLTAG_ENTRY_EX("notation", XSD_NAMESPACEA, OnNotation) 69 | XMLTAG_ENTRY_EX("simpleType", XSD_NAMESPACEA, OnSimpleType) 70 | XMLTAG_ENTRY_EX("complexType", XSD_NAMESPACEA, OnComplexType) 71 | END_XMLTAG_MAP() 72 | 73 | /* 74 | 86 | */ 87 | BEGIN_XMLATTR_MAP() 88 | XMLATTR_ENTRY("name", OnName) 89 | XMLATTR_ENTRY("targetNamespace", OnTargetNamespace) 90 | XMLATTR_ENTRY("id", OnID) 91 | XMLATTR_ENTRY("attributeFormDefault", OnAttributeFormDefault) 92 | XMLATTR_ENTRY("blockDefault", OnBlockDefault) 93 | XMLATTR_ENTRY("elementFormDefault", OnElementFormDefault) 94 | XMLATTR_ENTRY("finalDefault", OnFinalDefault) 95 | XMLATTR_ENTRY("version", OnVersion) 96 | END_XMLATTR_MAP() 97 | 98 | TAG_METHOD_DECL(OnInclude); 99 | TAG_METHOD_DECL(OnImport); 100 | TAG_METHOD_DECL(OnAnnotation); 101 | TAG_METHOD_DECL(OnRedefine); 102 | TAG_METHOD_DECL(OnAttribute); 103 | TAG_METHOD_DECL(OnAttributeGroup); 104 | TAG_METHOD_DECL(OnElement); 105 | TAG_METHOD_DECL(OnGroup); 106 | TAG_METHOD_DECL(OnNotation); 107 | TAG_METHOD_DECL(OnSimpleType); 108 | TAG_METHOD_DECL(OnComplexType); 109 | 110 | ATTR_METHOD_DECL(OnName); 111 | ATTR_METHOD_DECL(OnTargetNamespace); 112 | ATTR_METHOD_DECL(OnID); 113 | ATTR_METHOD_DECL(OnAttributeFormDefault); 114 | ATTR_METHOD_DECL(OnBlockDefault); 115 | ATTR_METHOD_DECL(OnElementFormDefault); 116 | ATTR_METHOD_DECL(OnFinalDefault); 117 | ATTR_METHOD_DECL(OnVersion); 118 | 119 | HRESULT __stdcall startPrefixMapping( 120 | const wchar_t *wszPrefix, 121 | int cchPrefix, 122 | const wchar_t *wszUri, 123 | int cchUri); 124 | }; -------------------------------------------------------------------------------- /source/SProxy/SimpleType.h: -------------------------------------------------------------------------------- 1 | // 2 | // SimpleType.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "XSDElement.h" 11 | #include "QName.h" 12 | 13 | // typedef CStringW CEnumeration; 14 | // typedef CStringElementTraits CEnumerationElementTraits; 15 | 16 | class CEnumeration 17 | { 18 | private: 19 | 20 | CStringW m_strValue; 21 | 22 | public: 23 | 24 | inline HRESULT SetValue(const wchar_t *wszValue, int cchValue) 25 | { 26 | if (!wszValue) 27 | { 28 | return E_FAIL; 29 | } 30 | 31 | m_strValue.SetString(wszValue, cchValue); 32 | 33 | return S_OK; 34 | } 35 | 36 | inline HRESULT SetValue(const CStringW& strValue) 37 | { 38 | m_strValue = strValue; 39 | 40 | return S_OK; 41 | } 42 | 43 | const CStringW& GetValue() 44 | { 45 | return m_strValue; 46 | } 47 | 48 | const CStringW& GetValue() const 49 | { 50 | return m_strValue; 51 | } 52 | }; 53 | 54 | class CEnumerationElementTraits : 55 | public CElementTraitsBase 56 | { 57 | public: 58 | 59 | static ULONG Hash( INARGTYPE e ) 60 | { 61 | LPCWSTR wsz = (LPCWSTR) e.GetValue(); 62 | ULONG nHash = 0; 63 | while (*wsz != 0) 64 | { 65 | nHash = (nHash<<5)+nHash+(*wsz); 66 | wsz++; 67 | } 68 | 69 | return nHash; 70 | } 71 | 72 | static bool CompareElements(INARGTYPE e1, INARGTYPE e2) 73 | { 74 | return e1.GetValue() == e2.GetValue(); 75 | } 76 | 77 | static int CompareElementsOrdered(INARGTYPE e1, INARGTYPE e2) 78 | { 79 | return (CStringW::StrTraits::StringCompare(e1.GetValue(), e2.GetValue())); 80 | } 81 | }; 82 | 83 | 84 | enum ENCODING_TYPE 85 | { 86 | ENCODING_ERR = 0, 87 | ENCODING_UNK, 88 | ENCODING_HEX, 89 | ENCODING_BASE64 90 | }; 91 | 92 | ENCODING_TYPE GetEncodingAttribute(const wchar_t *wszVal, int cchVal); 93 | 94 | class CSimpleType : public CXSDElement 95 | { 96 | private: 97 | 98 | CAtlList m_enumerations; 99 | ENCODING_TYPE m_encType; 100 | int m_nLength; 101 | int m_nMaxLength; 102 | int m_nMinLength; 103 | 104 | CStringW m_strName; 105 | CQName m_base; 106 | 107 | public: 108 | 109 | CSimpleType() 110 | :m_encType(ENCODING_UNK), m_nLength(-1), m_nMaxLength(-1), m_nMinLength(-1) 111 | { 112 | SetElementType(XSD_SIMPLETYPE); 113 | } 114 | 115 | inline HRESULT SetName(const wchar_t *wszName, int cchName) 116 | { 117 | if (!wszName) 118 | { 119 | return E_FAIL; 120 | } 121 | 122 | m_strName.SetString(wszName, cchName); 123 | 124 | return S_OK; 125 | } 126 | 127 | inline HRESULT SetName(const CStringW& strName) 128 | { 129 | m_strName = strName; 130 | 131 | return S_OK; 132 | } 133 | 134 | inline HRESULT SetBase(const CStringW& strQName) 135 | { 136 | m_base.SetQName(strQName); 137 | 138 | return S_OK; 139 | } 140 | 141 | inline HRESULT SetBase(const CStringW& strPrefix, const CStringW& strName) 142 | { 143 | m_base.SetQName(strPrefix, strName); 144 | 145 | return S_OK; 146 | } 147 | 148 | inline HRESULT SetBase(const wchar_t *wszQName, int cchQName) 149 | { 150 | m_base.SetQName(wszQName, cchQName); 151 | 152 | return S_OK; 153 | } 154 | 155 | inline CQName& GetBase() 156 | { 157 | return m_base; 158 | } 159 | 160 | inline const CStringW& GetName() 161 | { 162 | return m_strName; 163 | } 164 | 165 | inline ENCODING_TYPE GetEncodingType() 166 | { 167 | return m_encType; 168 | } 169 | 170 | inline ENCODING_TYPE SetEncodingType(ENCODING_TYPE encType) 171 | { 172 | return m_encType = encType; 173 | } 174 | 175 | inline HRESULT SetEncodingType(const wchar_t * wszVal, int cchVal) 176 | { 177 | m_encType = GetEncodingAttribute(wszVal, cchVal); 178 | if ((m_encType != ENCODING_ERR) && 179 | (m_encType != ENCODING_UNK)) 180 | { 181 | return S_OK; 182 | } 183 | return E_FAIL; 184 | } 185 | 186 | inline CEnumeration * AddEnumeration(CEnumeration* pEnum = NULL) 187 | { 188 | POSITION pos = NULL; 189 | if (pEnum != NULL) 190 | { 191 | pos = m_enumerations.AddTail(*pEnum); 192 | } 193 | else 194 | { 195 | CEnumeration e; 196 | pos = m_enumerations.AddTail(e); 197 | } 198 | 199 | if (pos != NULL) 200 | { 201 | return &(m_enumerations.GetAt(pos)); 202 | } 203 | 204 | return NULL; 205 | } 206 | 207 | inline POSITION GetFirstEnumeration() 208 | { 209 | return m_enumerations.GetHeadPosition(); 210 | } 211 | 212 | inline CEnumeration * GetNextEnumeration(POSITION &pos) 213 | { 214 | return &m_enumerations.GetNext(pos); 215 | } 216 | 217 | inline BOOL HasLength() 218 | { 219 | return (m_nLength != -1 ? TRUE : FALSE); 220 | } 221 | 222 | inline BOOL HasMinLength() 223 | { 224 | return (m_nMinLength != -1 ? TRUE : FALSE); 225 | } 226 | 227 | inline BOOL HasMaxLength() 228 | { 229 | return (m_nMaxLength != -1 ? TRUE : FALSE); 230 | } 231 | 232 | inline int GetLength() 233 | { 234 | return m_nLength; 235 | } 236 | 237 | inline void SetLength(int nLength) 238 | { 239 | m_nLength = nLength; 240 | } 241 | 242 | inline int GetMinLength() 243 | { 244 | return m_nMinLength; 245 | } 246 | 247 | inline void SetMinLength(int nLength) 248 | { 249 | m_nMinLength = nLength; 250 | } 251 | 252 | inline int GetMaxLength() 253 | { 254 | return m_nMaxLength; 255 | } 256 | 257 | inline void SetMaxLength(int nLength) 258 | { 259 | m_nMaxLength = nLength; 260 | } 261 | }; 262 | 263 | inline ENCODING_TYPE GetEncodingAttribute(const wchar_t *wszVal, int cchVal) 264 | { 265 | ENCODING_TYPE ret = ENCODING_ERR; 266 | if (cchVal == sizeof("hex")-1 && !wcsncmp(wszVal, L"hex", cchVal)) 267 | { 268 | ret = ENCODING_HEX; 269 | } 270 | else if (cchVal == sizeof("base64")-1 && !wcsncmp(wszVal, L"base64", cchVal)) 271 | { 272 | ret = ENCODING_BASE64; 273 | } 274 | 275 | return ret; 276 | } -------------------------------------------------------------------------------- /source/SProxy/SimpleTypeParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // SimpleTypeParser.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Parser.h" 11 | #include "resource.h" 12 | 13 | class CSimpleType; 14 | 15 | class CSimpleTypeParser : public CParserBase 16 | { 17 | private: 18 | 19 | CSimpleType * m_pType; 20 | 21 | public: 22 | 23 | inline CSimpleTypeParser(ISAXXMLReader *pReader, CParserBase *pParent, DWORD dwLevel, CSimpleType * pType) 24 | :CParserBase(pReader, pParent, dwLevel), m_pType(pType) 25 | { 26 | } 27 | 28 | inline CSimpleType * GetSimpleType() 29 | { 30 | return m_pType; 31 | } 32 | 33 | inline void SetSimpleType(CSimpleType * pType) 34 | { 35 | m_pType = pType; 36 | } 37 | 38 | inline void MarkUnsupported(const wchar_t *wszQName, int cchQName) 39 | { 40 | #ifdef _DEBUG 41 | int nLine; 42 | int nCol; 43 | GetLocator()->getLineNumber(&nLine); 44 | GetLocator()->getColumnNumber(&nCol); 45 | ATLTRACE( _T("%sUnsupported tag@(%d, %d) : %.*ws -- skipping element\n"), GetTabs(GetLevel()), 46 | nLine, nCol, 47 | cchQName, wszQName ); 48 | #endif 49 | } 50 | 51 | /* 52 | annotation, length, enumeration, pattern, scale, period, duration, 53 | maxLength, precision, minInclusive, minExclusive, maxInclusive, 54 | maxExclusive, minLength, encoding 55 | */ 56 | BEGIN_XMLTAG_MAP() 57 | XMLTAG_ENTRY_EX("enumeration", XSD_NAMESPACEA, OnEnumeration) 58 | XMLTAG_ENTRY_EX("annotation", XSD_NAMESPACEA, OnAnnotation) 59 | XMLTAG_ENTRY_EX("length", XSD_NAMESPACEA, OnLength) 60 | XMLTAG_ENTRY_EX("pattern", XSD_NAMESPACEA, OnPattern) 61 | XMLTAG_ENTRY_EX("scale", XSD_NAMESPACEA, OnScale) 62 | XMLTAG_ENTRY_EX("period", XSD_NAMESPACEA, OnPeriod) 63 | XMLTAG_ENTRY_EX("duration", XSD_NAMESPACEA, OnDuration) 64 | XMLTAG_ENTRY_EX("maxLength", XSD_NAMESPACEA, OnMaxLength) 65 | XMLTAG_ENTRY_EX("precision", XSD_NAMESPACEA, OnPrecision) 66 | XMLTAG_ENTRY_EX("minInclusive", XSD_NAMESPACEA, OnMinInclusive) 67 | XMLTAG_ENTRY_EX("minExclusive", XSD_NAMESPACEA, OnMinExclusive) 68 | XMLTAG_ENTRY_EX("maxInclusive", XSD_NAMESPACEA, OnMaxInclusive) 69 | XMLTAG_ENTRY_EX("maxExclusive", XSD_NAMESPACEA, OnMaxExclusive) 70 | XMLTAG_ENTRY_EX("minLength", XSD_NAMESPACEA, OnMinLength) 71 | XMLTAG_ENTRY_EX("encoding", XSD_NAMESPACEA, OnEncoding) 72 | 73 | // REVIEW: new one 74 | XMLTAG_ENTRY_EX("restriction", XSD_NAMESPACEA, OnRestriction) 75 | END_XMLTAG_MAP() 76 | 77 | /* 78 | 84 | */ 85 | BEGIN_XMLATTR_MAP() 86 | XMLATTR_ENTRY("name", OnName) 87 | XMLATTR_ENTRY("id", OnID) 88 | XMLATTR_ENTRY("abstract", OnAbstract) 89 | END_XMLATTR_MAP() 90 | 91 | TAG_METHOD_DECL(OnAnnotation); 92 | TAG_METHOD_DECL(OnLength); 93 | TAG_METHOD_DECL(OnPattern); 94 | TAG_METHOD_DECL(OnEnumeration); 95 | TAG_METHOD_DECL(OnScale); 96 | TAG_METHOD_DECL(OnPeriod); 97 | TAG_METHOD_DECL(OnDuration); 98 | TAG_METHOD_DECL(OnMaxLength); 99 | TAG_METHOD_DECL(OnPrecision); 100 | TAG_METHOD_DECL(OnMinInclusive); 101 | TAG_METHOD_DECL(OnMinExclusive); 102 | TAG_METHOD_DECL(OnMaxInclusive); 103 | TAG_METHOD_DECL(OnMaxExclusive); 104 | TAG_METHOD_DECL(OnMinLength); 105 | TAG_METHOD_DECL(OnEncoding); 106 | TAG_METHOD_DECL(OnRestriction); 107 | 108 | ATTR_METHOD_DECL(OnName); 109 | ATTR_METHOD_DECL(OnID); 110 | ATTR_METHOD_DECL(OnAbstract); 111 | 112 | HRESULT __stdcall startPrefixMapping( 113 | const wchar_t *wszPrefix, 114 | int cchPrefix, 115 | const wchar_t *wszUri, 116 | int cchUri); 117 | }; -------------------------------------------------------------------------------- /source/SProxy/SkipParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // SkipParser.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Parser.h" 11 | 12 | class CSkipParser : public CParserBase 13 | { 14 | public: 15 | 16 | inline CSkipParser(ISAXXMLReader *pReader, CParserBase *pParent, DWORD dwLevel) 17 | :CParserBase(pReader, pParent, dwLevel) 18 | { 19 | } 20 | 21 | virtual HRESULT OnUnrecognizedTag( 22 | const wchar_t *wszNamespaceUri, int cchNamespaceUri, 23 | const wchar_t *wszLocalName, int cchLocalName, 24 | const wchar_t *wszQName, int cchQName, 25 | ISAXAttributes *pAttributes) throw() 26 | { 27 | DisableReset(); 28 | return S_OK; 29 | } 30 | 31 | BEGIN_XMLTAG_MAP() 32 | END_XMLTAG_MAP() 33 | }; -------------------------------------------------------------------------------- /source/SProxy/SproxyColl.h: -------------------------------------------------------------------------------- 1 | // 2 | // SproxyColl.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | 11 | template > 12 | class CAtlPtrList : public CAtlList 13 | { 14 | private: 15 | typedef CAtlList Base; 16 | BOOL m_bAttached; 17 | 18 | public: 19 | 20 | CAtlPtrList() 21 | :m_bAttached(TRUE) 22 | { 23 | } 24 | 25 | void Detach() 26 | { 27 | m_bAttached = FALSE; 28 | } 29 | 30 | void RemoveAll() 31 | { 32 | if (m_bAttached) 33 | { 34 | POSITION pos = GetHeadPosition(); 35 | while (pos != NULL) 36 | { 37 | delete (GetAt(pos)); 38 | GetAt(pos) = NULL; 39 | GetNext(pos); 40 | } 41 | } 42 | Base::RemoveAll(); 43 | } 44 | 45 | ~CAtlPtrList() 46 | { 47 | RemoveAll(); 48 | } 49 | }; // class CAtlPtrList 50 | 51 | 52 | template , class VTraits = CElementTraits > 53 | class CAtlPtrMap : public CAtlMap 54 | { 55 | private: 56 | typedef CAtlMap Base; 57 | BOOL m_bAttached; 58 | 59 | public: 60 | 61 | CAtlPtrMap() 62 | :m_bAttached(TRUE) 63 | { 64 | } 65 | 66 | void Detach() 67 | { 68 | m_bAttached = FALSE; 69 | } 70 | 71 | void RemoveAll() 72 | { 73 | Base::DisableAutoRehash(); 74 | if (m_bAttached) 75 | { 76 | POSITION pos = GetStartPosition(); 77 | while (pos != NULL) 78 | { 79 | delete (GetValueAt(pos)); 80 | GetValueAt(pos) = NULL; 81 | GetNext(pos); 82 | } 83 | } 84 | Base::RemoveAll(); 85 | Base::EnableAutoRehash(); 86 | } 87 | 88 | ~CAtlPtrMap() 89 | { 90 | RemoveAll(); 91 | } 92 | }; // class CAtlPtrMap -------------------------------------------------------------------------------- /source/SProxy/SproxyError.h: -------------------------------------------------------------------------------- 1 | // 2 | // SproxyError.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" -------------------------------------------------------------------------------- /source/SProxy/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // sproxy.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | // 5 | // Copyright (c) Microsoft Corporation. All rights reserved. 6 | // 7 | 8 | #include "stdafx.h" 9 | 10 | // TODO: reference any additional headers you need in STDAFX.H 11 | // and not in this file 12 | -------------------------------------------------------------------------------- /source/SProxy/StdAfx.h: -------------------------------------------------------------------------------- 1 | // 2 | // stdafx.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #pragma warning(1: 4927) 10 | #pragma warning(1: 4928) 11 | 12 | #define _WIN32_WINNT 0x0502 13 | 14 | #ifdef _DEBUG 15 | #define ATL_DEBUG_STENCILS 16 | #endif 17 | 18 | #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "SproxyColl.h" 25 | #include "resource.h" 26 | 27 | #ifdef _DEBUG 28 | #include 29 | #endif 30 | 31 | #define _MAKEWIDESTR( str ) L ## str 32 | #define MAKEWIDESTR( str ) _MAKEWIDESTR( str ) 33 | 34 | #include "Namespaces.h" 35 | 36 | typedef CAtlMap, CStringRefElementTraits > NAMESPACEMAP; 37 | 38 | const wchar_t * GetWSDLFile(); 39 | 40 | #include "DiscoMapDocument.h" 41 | 42 | CDiscoMapDocument * GetDiscoMapDocument(); 43 | 44 | #ifdef _DEBUG 45 | 46 | inline const TCHAR * GetTabs(DWORD dwLevel) 47 | { 48 | static TCHAR s_szTabs[2048]; 49 | 50 | dwLevel = min(dwLevel, 2047); 51 | for (DWORD i=0; igetValueFromQName(wszAttrName, cchName, pwszValue, pcchValue) == S_OK ? S_OK : E_FAIL); 27 | } 28 | return (pAttributes->getValueFromName(wszNamespace, cchNamespace, 29 | wszAttrName, cchName, pwszValue, pcchValue) == S_OK ? S_OK : E_FAIL); 30 | } 31 | 32 | HRESULT GetAttribute( 33 | ISAXAttributes *pAttributes, 34 | const wchar_t *wszAttrName, int cchName, 35 | CStringW &strValue, 36 | wchar_t *wszNamespace, int cchNamespace) 37 | { 38 | const wchar_t *wszValue = NULL; 39 | int cchValue = 0; 40 | 41 | if (!pAttributes || !wszAttrName) 42 | { 43 | return E_INVALIDARG; 44 | } 45 | 46 | HRESULT hr; 47 | if (!wszNamespace) 48 | { 49 | hr = (pAttributes->getValueFromQName(wszAttrName, cchName, &wszValue, &cchValue) == S_OK ? S_OK : E_FAIL); 50 | } 51 | else 52 | { 53 | hr = (pAttributes->getValueFromName(wszNamespace, cchNamespace, 54 | wszAttrName, cchName, &wszValue, &cchValue) == S_OK ? S_OK : E_FAIL); 55 | } 56 | 57 | if (hr == S_OK) 58 | { 59 | strValue.SetString(wszValue, cchValue); 60 | } 61 | 62 | return hr; 63 | } 64 | 65 | inline int IsUnsafeCppChar(char ch) 66 | { 67 | return (!isalnum((unsigned char)ch) && ch != '_'); 68 | } 69 | 70 | void _CreateSafeCppName( 71 | char *szSafeName, 72 | const char *szName, 73 | const wchar_t *wszName, 74 | size_t nMaxLen) 75 | { 76 | ATLASSERT( szSafeName != NULL ); 77 | ATLASSERT( szName != NULL ); 78 | ATLASSERT( wszName != NULL ); 79 | 80 | static CCppKeywordLookup cppkwLookup; 81 | const CCppKeywordLookup::HashNode *p = cppkwLookup.Lookup(wszName); 82 | 83 | char *pszOut = szSafeName; 84 | 85 | size_t nLen = 0; 86 | if (p != NULL) 87 | { 88 | // append 3 underscores for a reserved keyword -- ugly, but hey... 89 | memcpy(pszOut, "___", 3); 90 | pszOut+= 3; 91 | nLen+= 3; 92 | } 93 | 94 | if (isdigit((unsigned char)(*szName))) 95 | { 96 | *pszOut++ = '_'; 97 | nLen++; 98 | } 99 | 100 | while (*szName) 101 | { 102 | if (nLen == nMaxLen) 103 | { 104 | // just truncate 105 | break; 106 | } 107 | 108 | if (IsUnsafeCppChar(*szName)) 109 | { 110 | *pszOut = '_'; 111 | } 112 | else 113 | { 114 | *pszOut = *szName; 115 | } 116 | pszOut++; 117 | szName++; 118 | nLen++; 119 | } 120 | 121 | *pszOut = '\0'; 122 | } 123 | 124 | size_t AllocateNameString(char **ppszName, const char *szName) 125 | { 126 | ATLASSERT( ppszName != NULL ); 127 | ATLASSERT( szName != NULL ); 128 | 129 | size_t nMaxLen = 3*strlen(szName); 130 | *ppszName = (char *)malloc(nMaxLen+1); 131 | if (!*ppszName) 132 | { 133 | return 0; 134 | } 135 | 136 | return nMaxLen; 137 | } 138 | 139 | size_t AllocateNameString(char **ppszName, const wchar_t *wszName) 140 | { 141 | ATLASSERT( ppszName != NULL ); 142 | ATLASSERT( wszName != NULL ); 143 | 144 | size_t nMaxLen = 3*wcslen(wszName); 145 | *ppszName = (char *)malloc(nMaxLen+1); 146 | if (!*ppszName) 147 | { 148 | return 0; 149 | } 150 | 151 | return nMaxLen; 152 | } 153 | 154 | HRESULT CreateSafeCppName(char **ppszName, const char *szName) 155 | { 156 | ATLASSERT( ppszName != NULL ); 157 | ATLASSERT( szName != NULL ); 158 | 159 | size_t nMaxLen = AllocateNameString(ppszName, szName); 160 | if (!nMaxLen) 161 | { 162 | return E_OUTOFMEMORY; 163 | } 164 | 165 | _CreateSafeCppName(*ppszName, szName, CA2W( szName ), nMaxLen); 166 | return S_OK; 167 | } 168 | 169 | HRESULT CreateSafeCppName(char **ppszName, const wchar_t *wszName) 170 | { 171 | ATLASSERT( ppszName != NULL ); 172 | ATLASSERT( wszName != NULL ); 173 | 174 | size_t nMaxLen = AllocateNameString(ppszName, wszName); 175 | if (!nMaxLen) 176 | { 177 | return E_OUTOFMEMORY; 178 | } 179 | 180 | _CreateSafeCppName(*ppszName, CW2A( wszName ), wszName, nMaxLen); 181 | return S_OK; 182 | } 183 | 184 | HRESULT CreateSafeCppName(CStringA& strSafeName, const wchar_t *wszName) 185 | { 186 | ATLASSERT( wszName != NULL ); 187 | 188 | size_t nMaxLen = 3*wcslen(wszName); 189 | 190 | char *szSafeName = strSafeName.GetBuffer((int) nMaxLen); 191 | 192 | _CreateSafeCppName(szSafeName, CW2A( wszName ), wszName, nMaxLen); 193 | 194 | strSafeName.ReleaseBuffer(); 195 | 196 | return S_OK; 197 | } 198 | 199 | HRESULT CreateSafeCppName(CStringA& strSafeName, const char *szName) 200 | { 201 | ATLASSERT( szName != NULL ); 202 | 203 | size_t nMaxLen = 3*strlen(szName); 204 | 205 | char *szSafeName = strSafeName.GetBuffer((int) nMaxLen); 206 | 207 | _CreateSafeCppName(szSafeName, szName, CA2W( szName ), nMaxLen); 208 | 209 | strSafeName.ReleaseBuffer(); 210 | 211 | return S_OK; 212 | } -------------------------------------------------------------------------------- /source/SProxy/Util.h: -------------------------------------------------------------------------------- 1 | // 2 | // Util.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | 11 | HRESULT GetAttribute( 12 | ISAXAttributes *pAttributes, 13 | const wchar_t *wszAttrName, int cchName, 14 | const wchar_t **pwszValue, int *pcchValue, 15 | wchar_t *wszNamespace = NULL, int cchNamespace = 0); 16 | 17 | HRESULT GetAttribute( 18 | ISAXAttributes *pAttributes, 19 | const wchar_t *wszAttrName, int cchName, 20 | CStringW &strValue, 21 | wchar_t *wszNamespace = NULL, int cchNamespace = 0); 22 | 23 | inline HRESULT GetBooleanValue(bool *pbOut, const wchar_t *wsz, int cch) 24 | { 25 | if (pbOut == NULL) 26 | { 27 | return E_POINTER; 28 | } 29 | 30 | if (wsz == NULL) 31 | { 32 | return E_INVALIDARG; 33 | } 34 | 35 | HRESULT hr = E_FAIL; 36 | 37 | switch (wsz[0]) 38 | { 39 | case L'1': 40 | { 41 | if (cch == 1) 42 | { 43 | *pbOut = true; 44 | hr = S_OK; 45 | } 46 | break; 47 | } 48 | case L'0': 49 | { 50 | if (cch == 1) 51 | { 52 | *pbOut = false; 53 | hr = S_OK; 54 | } 55 | break; 56 | } 57 | case L't': 58 | { 59 | if ((cch==sizeof("true")-1) && (!wcsncmp(wsz, L"true", cch))) 60 | { 61 | *pbOut = true; 62 | hr = S_OK; 63 | } 64 | break; 65 | } 66 | case L'f': 67 | { 68 | if ((cch==sizeof("false")-1) && (!wcsncmp(wsz, L"false", cch))) 69 | { 70 | *pbOut = false; 71 | hr = S_OK; 72 | } 73 | break; 74 | } 75 | } 76 | 77 | return hr; 78 | } -------------------------------------------------------------------------------- /source/SProxy/WSDLBinding.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLBinding.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | #include "WSDLBinding.h" 9 | #include "WSDLPortType.h" 10 | #include "WSDLDocument.h" 11 | #include "Emit.h" 12 | #include "resource.h" 13 | 14 | #include "Attribute.h" 15 | #include "Content.h" 16 | #include "Element.h" 17 | #include "ComplexType.h" 18 | 19 | CWSDLPortType * CWSDLBinding::GetPortType() 20 | { 21 | if (m_pPortType != NULL) 22 | { 23 | return m_pPortType; 24 | } 25 | 26 | CXMLDocument *pDoc = GetParentDocument(); 27 | if (pDoc != NULL) 28 | { 29 | CStringW strUri; 30 | if (SUCCEEDED(GetNamespaceUri(m_type.GetPrefix(), strUri))) 31 | { 32 | if (strUri == pDoc->GetTargetNamespace()) 33 | { 34 | if (pDoc->GetDocumentType() == WSDLDOC) 35 | { 36 | CWSDLDocument *pWSDLDoc = static_cast(pDoc); 37 | m_pPortType = pWSDLDoc->GetPortType(m_type.GetName()); 38 | } 39 | if (m_pPortType == NULL) 40 | { 41 | EmitFileError(IDS_SDL_UNRESOLVED_ELEM2, const_cast(this), 0, 42 | "portType", strUri, m_type.GetName()); 43 | } 44 | } 45 | } 46 | else 47 | { 48 | EmitFileError(IDS_SDL_UNRESOLVED_NAMESPACE, const_cast(this), 0, m_type.GetPrefix()); 49 | } 50 | } 51 | 52 | return m_pPortType; 53 | } -------------------------------------------------------------------------------- /source/SProxy/WSDLBinding.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLBinding.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "XMLElement.h" 11 | #include "QName.h" 12 | #include "Emit.h" 13 | 14 | #include "WSDLPortTypeOperation.h" 15 | 16 | class CWSDLPortType; 17 | 18 | class CSoapBinding : public CXMLElement 19 | { 20 | private: 21 | CStringW m_strTransport; 22 | SOAPSTYLE m_style; 23 | 24 | inline HRESULT ValidateStyle(const wchar_t *wsz, int cch) 25 | { 26 | m_style = ::GetStyle(wsz, cch); 27 | if (m_style != SOAPSTYLE_UNK) 28 | { 29 | return S_OK; 30 | } 31 | return E_FAIL; 32 | } 33 | 34 | public: 35 | 36 | CSoapBinding() 37 | :m_style(SOAPSTYLE_UNK) 38 | { 39 | } 40 | 41 | inline HRESULT SetTransport(const wchar_t *wszName, int cchName) 42 | { 43 | if (!wszName) 44 | { 45 | return E_FAIL; 46 | } 47 | 48 | m_strTransport.SetString(wszName, cchName); 49 | 50 | return S_OK; 51 | } 52 | 53 | inline void SetTransport(const CStringW& strName) 54 | { 55 | m_strTransport = strName; 56 | } 57 | 58 | inline const CStringW& GetTransport() 59 | { 60 | return m_strTransport; 61 | } 62 | 63 | inline HRESULT SetStyle(const wchar_t *wszName, int cchName) 64 | { 65 | if (!wszName) 66 | { 67 | return E_FAIL; 68 | } 69 | 70 | return ValidateStyle(wszName, cchName); 71 | } 72 | 73 | inline HRESULT SetStyle(const CStringW& strName) 74 | { 75 | return ValidateStyle(strName, strName.GetLength()); 76 | } 77 | 78 | inline const SOAPSTYLE GetStyle() 79 | { 80 | return m_style; 81 | } 82 | }; 83 | 84 | class CHttpBinding : public CXMLElement 85 | { 86 | private: 87 | 88 | CStringW m_strVerb; 89 | 90 | public: 91 | 92 | inline HRESULT SetVerb(const wchar_t *wszName, int cchName) 93 | { 94 | if (!wszName) 95 | { 96 | return E_FAIL; 97 | } 98 | 99 | m_strVerb.SetString(wszName, cchName); 100 | 101 | return S_OK; 102 | } 103 | 104 | inline HRESULT SetVerb(const CStringW& strName) 105 | { 106 | m_strVerb = strName; 107 | return S_OK; 108 | } 109 | 110 | inline const CStringW& GetVerb() 111 | { 112 | return m_strVerb; 113 | } 114 | }; 115 | 116 | class CWSDLBinding : public CXMLElement 117 | { 118 | private: 119 | 120 | CStringW m_strName; 121 | CQName m_type; 122 | 123 | CWSDLPortType * m_pPortType; 124 | 125 | CAutoPtr m_pSoapBinding; 126 | CAutoPtr m_pHttpBinding; 127 | 128 | typedef CAtlPtrMap > PORTYPEOPERATIONMAP; 129 | 130 | PORTYPEOPERATIONMAP m_operations; 131 | 132 | public: 133 | 134 | inline CWSDLBinding() 135 | :m_pPortType(NULL) 136 | { 137 | } 138 | 139 | CWSDLPortType * GetPortType(); 140 | 141 | inline CWSDLPortTypeOperation * AddOperation(CWSDLPortTypeOperation *p) 142 | { 143 | if (p != NULL) 144 | { 145 | if (p->GetName().GetLength() != 0) 146 | { 147 | if (m_operations.SetAt(p->GetName(), p) != NULL) 148 | { 149 | return p; 150 | } 151 | } 152 | } 153 | 154 | EmitErrorHr(E_OUTOFMEMORY); 155 | return NULL; 156 | } 157 | 158 | inline CSoapBinding * AddSoapBinding(CSoapBinding *pBinding = NULL) 159 | { 160 | if (pBinding == NULL) 161 | { 162 | pBinding = new CSoapBinding; 163 | } 164 | 165 | m_pSoapBinding.Attach( pBinding ); 166 | return m_pSoapBinding; 167 | } 168 | 169 | inline CSoapBinding * GetSoapBinding() 170 | { 171 | return m_pSoapBinding; 172 | } 173 | 174 | inline CHttpBinding * AddHttpBinding(CHttpBinding *pBinding = NULL) 175 | { 176 | if (pBinding == NULL) 177 | { 178 | pBinding = new CHttpBinding; 179 | } 180 | 181 | m_pHttpBinding.Attach( pBinding ); 182 | return m_pHttpBinding; 183 | } 184 | 185 | inline CHttpBinding * GetHttpBinding() 186 | { 187 | return m_pHttpBinding; 188 | } 189 | 190 | inline CWSDLPortTypeOperation * GetOperation(const CStringW& strName) 191 | { 192 | const PORTYPEOPERATIONMAP::CPair *p = m_operations.Lookup(strName); 193 | if (p != NULL) 194 | { 195 | return p->m_value; 196 | } 197 | 198 | return NULL; 199 | } 200 | 201 | inline POSITION GetFirstOperation() 202 | { 203 | return m_operations.GetStartPosition(); 204 | } 205 | 206 | inline CWSDLPortTypeOperation * GetNextOperation(POSITION &pos) 207 | { 208 | return m_operations.GetNextValue(pos); 209 | } 210 | 211 | inline HRESULT SetName(const wchar_t *wszName, int cchName) 212 | { 213 | if (!wszName) 214 | { 215 | return E_FAIL; 216 | } 217 | 218 | m_strName.SetString(wszName, cchName); 219 | 220 | return S_OK; 221 | } 222 | 223 | inline HRESULT SetName(const CStringW& strName) 224 | { 225 | m_strName = strName; 226 | 227 | return S_OK; 228 | } 229 | 230 | inline const CStringW& GetName() 231 | { 232 | return m_strName; 233 | } 234 | 235 | inline HRESULT SetType(const CStringW& strQName) 236 | { 237 | m_type.SetQName(strQName); 238 | 239 | return S_OK; 240 | } 241 | 242 | inline HRESULT SetType(const CStringW& strPrefix, const CStringW& strName) 243 | { 244 | m_type.SetQName(strPrefix, strName); 245 | 246 | return S_OK; 247 | } 248 | 249 | inline HRESULT SetType(const wchar_t *wszQName, int cchQName) 250 | { 251 | m_type.SetQName(wszQName, cchQName); 252 | 253 | return S_OK; 254 | } 255 | 256 | inline const CQName& GetType() 257 | { 258 | return m_type; 259 | } 260 | }; -------------------------------------------------------------------------------- /source/SProxy/WSDLBindingParser.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLBindingParser.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | 9 | #include "Util.h" 10 | 11 | #include "WSDLBindingParser.h" 12 | #include "WSDLOperationParser.h" 13 | 14 | #include "WSDLBinding.h" 15 | #include "Attribute.h" 16 | #include "Content.h" 17 | #include "Element.h" 18 | #include "ComplexType.h" 19 | 20 | TAG_METHOD_IMPL(CWSDLBindingParser, OnDocumentation) 21 | { 22 | TRACE_PARSE_ENTRY(); 23 | 24 | return SkipElement(); 25 | } 26 | 27 | TAG_METHOD_IMPL(CWSDLBindingParser, OnOperation) 28 | { 29 | TRACE_PARSE_ENTRY(); 30 | 31 | CWSDLBinding * pCurr = GetBinding(); 32 | if (pCurr != NULL) 33 | { 34 | CAutoPtr spElem; 35 | spElem.Attach( new CWSDLPortTypeOperation ); 36 | 37 | if (spElem != NULL) 38 | { 39 | SetXMLElementInfo(spElem, pCurr, GetLocator()); 40 | 41 | CAutoPtr p( new CWSDLOperationParser(GetReader(), this, GetLevel(), spElem) ); 42 | if (p) 43 | { 44 | if (g_ParserList.AddHead(p) != NULL) 45 | { 46 | if (SUCCEEDED(p.Detach()->GetAttributes(pAttributes))) 47 | { 48 | if (pCurr->AddOperation(spElem) != NULL) 49 | { 50 | spElem.Detach(); 51 | return S_OK; 52 | } 53 | } 54 | } 55 | } 56 | } 57 | } 58 | 59 | EmitErrorHr(E_OUTOFMEMORY); 60 | return E_FAIL; 61 | } 62 | 63 | TAG_METHOD_IMPL(CWSDLBindingParser, OnSoapBinding) 64 | { 65 | TRACE_PARSE_ENTRY(); 66 | 67 | CWSDLBinding * pCurr = GetBinding(); 68 | if (pCurr != NULL) 69 | { 70 | CSoapBinding *pBinding = pCurr->AddSoapBinding(); 71 | if (pBinding != NULL) 72 | { 73 | SetXMLElementInfo(pBinding, pCurr, GetLocator()); 74 | 75 | CStringW strTransport; 76 | if (S_OK == GetAttribute(pAttributes, L"transport", sizeof("transport")-1, strTransport)) 77 | { 78 | pBinding->SetTransport(strTransport); 79 | } 80 | 81 | const wchar_t *wszStyle; 82 | int cchStyle; 83 | HRESULT hr = S_OK; 84 | if (S_OK == GetAttribute(pAttributes, L"style", sizeof("style")-1, &wszStyle, &cchStyle)) 85 | { 86 | hr = pBinding->SetStyle(wszStyle, cchStyle); 87 | if (FAILED(hr)) 88 | { 89 | EmitInvalidValue("style", wszStyle); 90 | } 91 | } 92 | 93 | if (SUCCEEDED(hr)) 94 | { 95 | return SkipElement(); 96 | } 97 | } 98 | 99 | } 100 | 101 | EmitErrorHr(E_OUTOFMEMORY); 102 | 103 | return E_FAIL; 104 | } 105 | 106 | TAG_METHOD_IMPL(CWSDLBindingParser, OnHttpBinding) 107 | { 108 | TRACE_PARSE_ENTRY(); 109 | 110 | CWSDLBinding * pCurr = GetBinding(); 111 | if (pCurr != NULL) 112 | { 113 | CHttpBinding *pBinding = pCurr->AddHttpBinding(); 114 | if (pBinding != NULL) 115 | { 116 | SetXMLElementInfo(pBinding, pCurr, GetLocator()); 117 | 118 | CStringW strVerb; 119 | if (S_OK == GetAttribute(pAttributes, L"verb", sizeof("verb")-1, strVerb)) 120 | { 121 | if (SUCCEEDED(pBinding->SetVerb(strVerb))) 122 | { 123 | return SkipElement(); 124 | } 125 | } 126 | } 127 | } 128 | 129 | EmitErrorHr(E_OUTOFMEMORY); 130 | 131 | return E_FAIL; 132 | } 133 | 134 | //TAG_METHOD_IMPL(CWSDLBindingParser, OnSudsClass) 135 | //{ 136 | // TRACE_PARSE_ENTRY(); 137 | // 138 | // return SkipElement(); 139 | //} 140 | // 141 | //TAG_METHOD_IMPL(CWSDLBindingParser, OnStkPreferredBinding) 142 | //{ 143 | // TRACE_PARSE_ENTRY(); 144 | // 145 | // return SkipElement(); 146 | //} 147 | 148 | ATTR_METHOD_IMPL(CWSDLBindingParser, OnName) 149 | { 150 | TRACE_PARSE_ENTRY(); 151 | 152 | CWSDLBinding * pCurr = GetBinding(); 153 | if (pCurr != NULL) 154 | { 155 | return pCurr->SetName(wszValue, cchValue); 156 | } 157 | 158 | EmitError(IDS_SDL_INTERNAL); 159 | 160 | return E_FAIL; 161 | } 162 | 163 | ATTR_METHOD_IMPL(CWSDLBindingParser, OnType) 164 | { 165 | TRACE_PARSE_ENTRY(); 166 | 167 | CWSDLBinding * pCurr = GetBinding(); 168 | if (pCurr != NULL) 169 | { 170 | return pCurr->SetType(wszValue, cchValue); 171 | } 172 | 173 | EmitError(IDS_SDL_INTERNAL); 174 | 175 | return E_FAIL; 176 | } 177 | 178 | HRESULT __stdcall CWSDLBindingParser::startPrefixMapping( 179 | const wchar_t *wszPrefix, 180 | int cchPrefix, 181 | const wchar_t *wszUri, 182 | int cchUri) 183 | { 184 | CWSDLBinding * pCurr = GetBinding(); 185 | if (pCurr != NULL) 186 | { 187 | return pCurr->SetNamespaceUri(wszPrefix, cchPrefix, wszUri, cchUri); 188 | } 189 | return E_FAIL; 190 | } 191 | 192 | HRESULT CWSDLBindingParser::OnUnrecognizedTag( 193 | const wchar_t *wszNamespaceUri, int cchNamespaceUri, 194 | const wchar_t *wszLocalName, int cchLocalName, 195 | const wchar_t * /*wszQName*/, int /*cchQName*/, 196 | ISAXAttributes * /*pAttributes*/) throw() 197 | { 198 | CWSDLBinding *pCurr = GetBinding(); 199 | if (pCurr != NULL) 200 | { 201 | int nLine; 202 | int nCol; 203 | GetLocator()->getLineNumber(&nLine); 204 | GetLocator()->getColumnNumber(&nCol); 205 | 206 | EmitFileWarning(IDS_SDL_SKIP_EXTENSIBILITY, 207 | pCurr->GetParentDocument()->GetDocumentUri(), 208 | nLine, 209 | nCol, 210 | 0, 211 | wszNamespaceUri, 212 | wszLocalName); 213 | } 214 | return SkipElement(); 215 | } -------------------------------------------------------------------------------- /source/SProxy/WSDLBindingParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLBindingParser.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Parser.h" 11 | 12 | class CWSDLBinding; 13 | 14 | class CWSDLBindingParser : public CParserBase 15 | { 16 | private: 17 | 18 | CWSDLBinding *m_pBinding; 19 | 20 | public: 21 | 22 | inline CWSDLBindingParser(ISAXXMLReader *pReader, CParserBase *pParent, DWORD dwLevel, CWSDLBinding *pBinding = NULL) 23 | :CParserBase(pReader, pParent, dwLevel), m_pBinding(pBinding) 24 | { 25 | } 26 | 27 | BEGIN_XMLTAG_MAP() 28 | XMLTAG_ENTRY_EX("binding", SOAP_NAMESPACEA, OnSoapBinding) 29 | XMLTAG_ENTRY_EX("operation", WSDL_NAMESPACEA, OnOperation) 30 | XMLTAG_ENTRY_EX("binding", HTTP_NAMESPACEA, OnHttpBinding) 31 | XMLTAG_ENTRY_EX("documentation", WSDL_NAMESPACEA, OnDocumentation) 32 | 33 | // extensibility elements 34 | // XMLTAG_ENTRY_EX("class", SUDS_NAMESPACEA, OnSudsClass) 35 | // XMLTAG_ENTRY_EX("binding", STK_PREFERREDENCODING_NAMESPACEA, OnStkPreferredBinding) 36 | END_XMLTAG_MAP() 37 | 38 | BEGIN_XMLATTR_MAP() 39 | XMLATTR_ENTRY("name", OnName) 40 | XMLATTR_ENTRY("type", OnType) 41 | END_XMLATTR_MAP() 42 | 43 | TAG_METHOD_DECL(OnDocumentation); 44 | TAG_METHOD_DECL(OnOperation); 45 | TAG_METHOD_DECL(OnSoapBinding); 46 | TAG_METHOD_DECL(OnHttpBinding); 47 | 48 | // TAG_METHOD_DECL(OnSudsClass); 49 | // TAG_METHOD_DECL(OnStkPreferredBinding); 50 | 51 | ATTR_METHOD_DECL(OnName); 52 | ATTR_METHOD_DECL(OnType); 53 | 54 | inline CWSDLBinding * GetBinding() 55 | { 56 | return m_pBinding; 57 | } 58 | 59 | inline void SetBinding(CWSDLBinding * pBinding) 60 | { 61 | ATLASSERT( pBinding != NULL ); 62 | 63 | m_pBinding = pBinding; 64 | } 65 | 66 | HRESULT __stdcall startPrefixMapping( 67 | const wchar_t *wszPrefix, 68 | int cchPrefix, 69 | const wchar_t *wszUri, 70 | int cchUri); 71 | 72 | HRESULT OnUnrecognizedTag( 73 | const wchar_t *wszNamespaceUri, int cchNamespaceUri, 74 | const wchar_t *wszLocalName, int cchLocalName, 75 | const wchar_t *wszQName, int cchQName, 76 | ISAXAttributes *pAttributes) throw(); 77 | }; -------------------------------------------------------------------------------- /source/SProxy/WSDLMessage.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLMessage.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "XMLElement.h" 11 | #include "WSDLMessagePart.h" 12 | #include "Emit.h" 13 | 14 | class CWSDLMessage : public CXMLElement 15 | { 16 | private: 17 | 18 | CStringW m_strDocumentation; 19 | CStringW m_strName; 20 | CAtlPtrList m_parts; 21 | 22 | public: 23 | 24 | inline POSITION GetFirstPart() 25 | { 26 | return m_parts.GetHeadPosition(); 27 | } 28 | 29 | inline CWSDLMessagePart * GetNextPart(POSITION& pos) 30 | { 31 | return m_parts.GetNext(pos); 32 | } 33 | 34 | inline CWSDLMessagePart * GetPartByName(CStringW& strName) 35 | { 36 | POSITION pos = m_parts.GetHeadPosition(); 37 | while (pos != NULL) 38 | { 39 | if (m_parts.GetAt(pos)->GetName() == strName) 40 | { 41 | break; 42 | } 43 | m_parts.GetNext(pos); 44 | } 45 | 46 | if (pos != NULL) 47 | { 48 | return m_parts.GetAt(pos); 49 | } 50 | return NULL; 51 | } 52 | 53 | inline CWSDLMessagePart * AddPart() 54 | { 55 | CAutoPtr p ( new CWSDLMessagePart ); 56 | if (p != NULL) 57 | { 58 | if (m_parts.AddTail(p) != NULL) 59 | { 60 | return p.Detach(); 61 | } 62 | } 63 | 64 | EmitErrorHr(E_OUTOFMEMORY); 65 | return NULL; 66 | } 67 | 68 | inline CWSDLMessagePart * AddPart(CWSDLMessagePart *part) 69 | { 70 | if (m_parts.AddTail(part) != NULL) 71 | { 72 | return part; 73 | } 74 | 75 | EmitErrorHr(E_OUTOFMEMORY); 76 | return NULL; 77 | } 78 | 79 | inline size_t GetNumParts() 80 | { 81 | return m_parts.GetCount(); 82 | } 83 | 84 | inline HRESULT SetName(const CStringW& strName) 85 | { 86 | m_strName = strName; 87 | return S_OK; 88 | } 89 | 90 | inline HRESULT SetName(const wchar_t *wszName, int cchName) 91 | { 92 | if (!wszName) 93 | { 94 | return E_FAIL; 95 | } 96 | 97 | m_strName.SetString(wszName, cchName); 98 | 99 | return S_OK; 100 | } 101 | 102 | inline const CStringW& GetName() 103 | { 104 | return m_strName; 105 | } 106 | }; -------------------------------------------------------------------------------- /source/SProxy/WSDLMessageParser.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLMessageParser.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | #include "Util.h" 9 | #include "WSDLMessageParser.h" 10 | 11 | #include "WSDLMessage.h" 12 | #include "Attribute.h" 13 | #include "Content.h" 14 | #include "Element.h" 15 | #include "ComplexType.h" 16 | 17 | TAG_METHOD_IMPL(CWSDLMessageParser, OnDocumentation) 18 | { 19 | TRACE_PARSE_ENTRY(); 20 | 21 | return SkipElement(); 22 | } 23 | 24 | TAG_METHOD_IMPL(CWSDLMessageParser, OnPart) 25 | { 26 | TRACE_PARSE_ENTRY(); 27 | 28 | CWSDLMessage *pCurr = GetMessage(); 29 | if (pCurr != NULL) 30 | { 31 | CWSDLMessagePart *pPart = pCurr->AddPart(); 32 | if (pPart != NULL) 33 | { 34 | SetXMLElementInfo(pPart, pCurr, GetLocator()); 35 | 36 | CStringW strName; 37 | if (S_OK == GetAttribute(pAttributes, L"name", sizeof("name")-1, strName)) 38 | { 39 | pPart->SetName(strName); 40 | 41 | CStringW strElement; 42 | if (S_OK == GetAttribute(pAttributes, L"element", sizeof("element")-1, strElement)) 43 | { 44 | pPart->SetElement(strElement); 45 | } 46 | CStringW strType; 47 | if (S_OK == GetAttribute(pAttributes, L"type", sizeof("type")-1, strType)) 48 | { 49 | pPart->SetType(strType); 50 | } 51 | // else 52 | // { 53 | // OnMissingAttribute(TRUE, L"element", sizeof("element")-1, L"", 0); 54 | // } 55 | 56 | return SkipElement(); 57 | } 58 | OnMissingAttribute(TRUE, L"name", sizeof("name")-1, L"", 0); 59 | } 60 | } 61 | 62 | EmitErrorHr(E_OUTOFMEMORY); 63 | 64 | return E_FAIL; 65 | } 66 | 67 | ATTR_METHOD_IMPL(CWSDLMessageParser, OnName) 68 | { 69 | TRACE_PARSE_ENTRY(); 70 | 71 | CWSDLMessage *pCurr = GetMessage(); 72 | if (pCurr != NULL) 73 | { 74 | return pCurr->SetName(wszValue, cchValue); 75 | } 76 | 77 | EmitError(IDS_SDL_INTERNAL); 78 | 79 | return E_FAIL; 80 | } 81 | 82 | HRESULT __stdcall CWSDLMessageParser::startPrefixMapping( 83 | const wchar_t *wszPrefix, 84 | int cchPrefix, 85 | const wchar_t *wszUri, 86 | int cchUri) 87 | { 88 | CWSDLMessage *pCurr = GetMessage(); 89 | if (pCurr != NULL) 90 | { 91 | return pCurr->SetNamespaceUri(wszPrefix, cchPrefix, wszUri, cchUri); 92 | } 93 | return E_FAIL; 94 | } -------------------------------------------------------------------------------- /source/SProxy/WSDLMessageParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLMessageParser.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Parser.h" 11 | 12 | class CWSDLMessage; 13 | 14 | class CWSDLMessageParser : public CParserBase 15 | { 16 | private: 17 | 18 | CWSDLMessage * m_pMessage; 19 | 20 | public: 21 | 22 | inline CWSDLMessageParser(ISAXXMLReader *pReader, CParserBase *pParent, DWORD dwLevel, CWSDLMessage *pMessage = NULL) 23 | :CParserBase(pReader, pParent, dwLevel), m_pMessage(pMessage) 24 | { 25 | } 26 | 27 | BEGIN_XMLTAG_MAP() 28 | XMLTAG_ENTRY_EX("documentation", WSDL_NAMESPACEA, OnDocumentation) 29 | XMLTAG_ENTRY_EX("part", WSDL_NAMESPACEA, OnPart) 30 | END_XMLTAG_MAP() 31 | 32 | BEGIN_XMLATTR_MAP() 33 | XMLATTR_ENTRY("name", OnName) 34 | END_XMLATTR_MAP() 35 | 36 | TAG_METHOD_DECL(OnDocumentation); 37 | TAG_METHOD_DECL(OnPart); 38 | 39 | ATTR_METHOD_DECL(OnName); 40 | 41 | inline CWSDLMessage * GetMessage() 42 | { 43 | return m_pMessage; 44 | } 45 | 46 | inline void SetMessage(CWSDLMessage *pMessage) 47 | { 48 | ATLASSERT( m_pMessage == NULL ); 49 | 50 | m_pMessage = pMessage; 51 | } 52 | 53 | HRESULT __stdcall startPrefixMapping( 54 | const wchar_t *wszPrefix, 55 | int cchPrefix, 56 | const wchar_t *wszUri, 57 | int cchUri); 58 | }; -------------------------------------------------------------------------------- /source/SProxy/WSDLMessagePart.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLMessagePart.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | #include "WSDLMessagePart.h" 9 | #include "WSDLDocument.h" 10 | 11 | #include "Attribute.h" 12 | #include "Content.h" 13 | #include "Element.h" 14 | #include "ComplexType.h" 15 | 16 | // 17 | // TODO: import stuff, errors 18 | // 19 | HRESULT CWSDLMessagePart::GetElement(CElement **ppElement) 20 | { 21 | ATLASSERT( ppElement != NULL ); 22 | *ppElement = NULL; 23 | if (m_pElement != NULL) 24 | { 25 | *ppElement = m_pElement; 26 | return S_OK; 27 | } 28 | 29 | CXMLDocument *pDoc = GetParentDocument(); 30 | if (pDoc != NULL) 31 | { 32 | CStringW strUri; 33 | if (m_element.GetName().GetLength() != 0) 34 | { 35 | if (SUCCEEDED(GetNamespaceUri(m_element.GetPrefix(), strUri))) 36 | { 37 | // 38 | // TODO: fix this part to handle imports (includes?) 39 | // 40 | // if (strUri == pDoc->GetTargetNamespace()) 41 | // { 42 | if (pDoc->GetDocumentType() == WSDLDOC) 43 | { 44 | CWSDLDocument *pWSDLDoc = static_cast(pDoc); 45 | m_pElement = pWSDLDoc->GetElement(m_element.GetName(), strUri); 46 | } 47 | // } 48 | } 49 | } 50 | } 51 | 52 | // return m_pElement; 53 | *ppElement = m_pElement; 54 | if (m_pElement != NULL) 55 | { 56 | return S_OK; 57 | } 58 | return E_FAIL; 59 | } 60 | 61 | // 62 | // TODO: import stuff, errors 63 | // 64 | HRESULT CWSDLMessagePart::GetType(CXSDElement **ppElement, XSDTYPE *pXSD) 65 | { 66 | ATLASSERT( pXSD != NULL ); 67 | ATLASSERT( ppElement != NULL ); 68 | 69 | *pXSD = XSDTYPE_ERR; 70 | *ppElement = NULL; 71 | 72 | if (m_pXSDElement != NULL) 73 | { 74 | // we've already processed it as a simpleType or complexType 75 | *ppElement = m_pXSDElement; 76 | return S_OK; 77 | } 78 | 79 | // REVIEW (jasjitg): maybe cache the XSDTYPE, as well... ? 80 | 81 | CXMLDocument *pDoc = GetParentDocument(); 82 | CStringW strUri; 83 | if (pDoc != NULL) 84 | { 85 | if (m_type.GetName().GetLength() != 0) 86 | { 87 | if (SUCCEEDED(GetNamespaceUri(m_type.GetPrefix(), strUri))) 88 | { 89 | // check CLR/FX-specific namespaces 90 | if ((strUri == FX_TYPES_NAMESPACEW) || 91 | (strUri == CLR_TYPES_NAMESPACEW)) 92 | { 93 | // treat their custom types as strings 94 | *pXSD = XSDTYPE_STRING; 95 | EmitFileWarning(IDS_SDL_CUSTOM_TYPE, const_cast(this), 0, 96 | strUri, m_type.GetName()); 97 | } 98 | else 99 | { 100 | // 101 | // TODO: fix this part to handle imports (includes?) 102 | // 103 | if (S_FALSE == GetXSDType(strUri, m_type.GetName(), pXSD)) 104 | { 105 | if (pDoc->GetDocumentType() == WSDLDOC) 106 | { 107 | CWSDLDocument *pWSDLDoc = static_cast(pDoc); 108 | 109 | // complexType or simpleType 110 | m_pXSDElement = pWSDLDoc->GetComplexType(m_type.GetName(), strUri); 111 | if (m_pXSDElement == NULL) 112 | { 113 | m_pXSDElement = pWSDLDoc->GetSimpleType(m_type.GetName(), strUri); 114 | } 115 | } 116 | } 117 | } 118 | } 119 | } 120 | } 121 | 122 | *ppElement = m_pXSDElement; 123 | if ((m_pXSDElement != NULL) || (*pXSD != XSDTYPE_ERR)) 124 | { 125 | return S_OK; 126 | } 127 | 128 | if (strUri.GetLength() == 0) 129 | { 130 | EmitFileError(IDS_SDL_UNRESOLVED_NAMESPACE, const_cast(this), 0, m_type.GetPrefix()); 131 | } 132 | else 133 | { 134 | EmitFileError(IDS_SDL_UNRESOLVED_ELEM2, const_cast(this), 0, "part", strUri, m_type.GetName()); 135 | } 136 | return E_FAIL; 137 | } -------------------------------------------------------------------------------- /source/SProxy/WSDLMessagePart.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLPart.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "QName.h" 11 | #include "XMLElement.h" 12 | #include "XSDElement.h" 13 | 14 | class CElement; 15 | class CXSDElement; 16 | 17 | class CWSDLMessagePart : public CXMLElement 18 | { 19 | private: 20 | 21 | CStringW m_strName; 22 | CQName m_element; 23 | CQName m_type; 24 | 25 | CElement * m_pElement; 26 | CXSDElement * m_pXSDElement; 27 | 28 | public: 29 | 30 | inline CWSDLMessagePart() 31 | :m_pElement(NULL), m_pXSDElement(NULL) 32 | { 33 | } 34 | 35 | inline CWSDLMessagePart(CXMLDocument *pDoc) 36 | :CXMLElement(pDoc) 37 | { 38 | } 39 | 40 | inline CWSDLMessagePart(const CWSDLMessagePart& that) 41 | { 42 | *this = that; 43 | } 44 | 45 | inline const CWSDLMessagePart& operator=(const CWSDLMessagePart& that) 46 | { 47 | if (this != &that) 48 | { 49 | m_strName = that.m_strName; 50 | m_element = that.m_element; 51 | } 52 | 53 | return *this; 54 | } 55 | 56 | inline void SetName(const CStringW& strName) 57 | { 58 | m_strName = strName; 59 | } 60 | 61 | inline const CStringW& GetName() 62 | { 63 | return m_strName; 64 | } 65 | 66 | inline void SetElement(const CStringW& strQName) 67 | { 68 | m_element.SetQName(strQName); 69 | } 70 | 71 | inline void SetElement(const CStringW& strPrefix, const CStringW& strName) 72 | { 73 | m_element.SetQName(strPrefix, strName); 74 | } 75 | 76 | inline void SetElement(const wchar_t *wszQName, int cchQName) 77 | { 78 | m_element.SetQName(wszQName, cchQName); 79 | } 80 | 81 | inline CQName& GetElementName() 82 | { 83 | return m_element; 84 | } 85 | 86 | inline void SetType(const CStringW& strQName) 87 | { 88 | m_type.SetQName(strQName); 89 | } 90 | 91 | inline void SetType(const CStringW& strPrefix, const CStringW& strName) 92 | { 93 | m_type.SetQName(strPrefix, strName); 94 | } 95 | 96 | inline void SetType(const wchar_t *wszQName, int cchQName) 97 | { 98 | m_type.SetQName(wszQName, cchQName); 99 | } 100 | 101 | inline CQName& GetTypeName() 102 | { 103 | return m_type; 104 | } 105 | 106 | // 107 | // TODO: import stuff 108 | // 109 | HRESULT GetElement(CElement **ppElement); 110 | HRESULT GetType(CXSDElement **ppElement, XSDTYPE *pXSD); 111 | }; -------------------------------------------------------------------------------- /source/SProxy/WSDLOperationIOParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLPortTypeIOParser.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Parser.h" 11 | 12 | class CWSDLPortTypeIO; 13 | 14 | class CWSDLOperationIOParser : public CParserBase 15 | { 16 | private: 17 | 18 | CWSDLPortTypeIO * m_pIO; 19 | 20 | public: 21 | 22 | inline CWSDLOperationIOParser(ISAXXMLReader *pReader, CParserBase *pParent, DWORD dwLevel, CWSDLPortTypeIO * pIO = NULL) 23 | :CParserBase(pReader, pParent, dwLevel), m_pIO(pIO) 24 | { 25 | } 26 | 27 | BEGIN_XMLTAG_MAP() 28 | XMLTAG_ENTRY_EX("body", SOAP_NAMESPACEA, OnSoapBody) 29 | XMLTAG_ENTRY_EX("header", SOAP_NAMESPACEA, OnSoapHeader) 30 | XMLTAG_ENTRY_EX("headerfault", SOAP_NAMESPACEA, OnSoapHeaderFault) 31 | XMLTAG_ENTRY_EX("fault", SOAP_NAMESPACEA, OnSoapFault) 32 | XMLTAG_ENTRY_EX("content", MIME_NAMESPACEA, OnMimeContent) 33 | XMLTAG_ENTRY_EX("mimeXml", MIME_NAMESPACEA, OnMimeXML) 34 | XMLTAG_ENTRY_EX("multipartRelated", MIME_NAMESPACEA, OnMimeMultipartRelated) 35 | XMLTAG_ENTRY_EX("urlEncoded", HTTP_NAMESPACEA, OnHttpUrlEncoded) 36 | XMLTAG_ENTRY_EX("documentation", WSDL_NAMESPACEA, OnDocumentation) 37 | END_XMLTAG_MAP() 38 | 39 | BEGIN_XMLATTR_MAP() 40 | XMLATTR_ENTRY("name", OnName) 41 | XMLATTR_ENTRY("message", OnMessage) 42 | END_XMLATTR_MAP() 43 | 44 | TAG_METHOD_DECL(OnSoapBody); 45 | TAG_METHOD_DECL(OnDocumentation); 46 | TAG_METHOD_DECL(OnSoapHeader); 47 | TAG_METHOD_DECL(OnSoapHeaderFault); 48 | TAG_METHOD_DECL(OnSoapFault); 49 | TAG_METHOD_DECL(OnMimeContent); 50 | TAG_METHOD_DECL(OnMimeXML); 51 | TAG_METHOD_DECL(OnMimeMultipartRelated); 52 | TAG_METHOD_DECL(OnHttpUrlEncoded); 53 | 54 | ATTR_METHOD_DECL(OnName); 55 | ATTR_METHOD_DECL(OnMessage); 56 | 57 | inline CWSDLPortTypeIO * GetIO() 58 | { 59 | return m_pIO; 60 | } 61 | 62 | inline void SetIO(CWSDLPortTypeIO * pIO) 63 | { 64 | ATLASSERT( pIO != NULL ); 65 | 66 | m_pIO = pIO; 67 | } 68 | 69 | HRESULT __stdcall startPrefixMapping( 70 | const wchar_t *wszPrefix, 71 | int cchPrefix, 72 | const wchar_t *wszUri, 73 | int cchUri); 74 | 75 | HRESULT OnUnrecognizedTag( 76 | const wchar_t *wszNamespaceUri, int cchNamespaceUri, 77 | const wchar_t *wszLocalName, int cchLocalName, 78 | const wchar_t *wszQName, int cchQName, 79 | ISAXAttributes *pAttributes) throw(); 80 | }; -------------------------------------------------------------------------------- /source/SProxy/WSDLOperationParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLOperationParser.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Parser.h" 11 | #include "WSDLPortTypeIO.h" 12 | 13 | 14 | class CWSDLPortTypeOperation; 15 | 16 | class CWSDLOperationParser : public CParserBase 17 | { 18 | private: 19 | 20 | CWSDLPortTypeOperation *m_pOperation; 21 | 22 | public: 23 | 24 | inline CWSDLOperationParser(ISAXXMLReader *pReader, CParserBase *pParent, DWORD dwLevel, CWSDLPortTypeOperation *pOperation = NULL) 25 | :CParserBase(pReader, pParent, dwLevel), m_pOperation(pOperation) 26 | { 27 | } 28 | 29 | BEGIN_XMLTAG_MAP() 30 | XMLTAG_ENTRY_EX("input", WSDL_NAMESPACEA, OnInput) 31 | XMLTAG_ENTRY_EX("output", WSDL_NAMESPACEA, OnOutput) 32 | XMLTAG_ENTRY_EX("fault", WSDL_NAMESPACEA, OnFault) 33 | XMLTAG_ENTRY_EX("operation", SOAP_NAMESPACEA, OnSoapOperation) 34 | XMLTAG_ENTRY_EX("operation", HTTP_NAMESPACEA, OnHttpOperation) 35 | XMLTAG_ENTRY_EX("documentation", WSDL_NAMESPACEA, OnDocumentation) 36 | END_XMLTAG_MAP() 37 | 38 | BEGIN_XMLATTR_MAP() 39 | XMLATTR_ENTRY("name", OnName) 40 | END_XMLATTR_MAP() 41 | 42 | TAG_METHOD_DECL(OnDocumentation); 43 | TAG_METHOD_DECL(OnInput); 44 | TAG_METHOD_DECL(OnOutput); 45 | TAG_METHOD_DECL(OnFault); 46 | TAG_METHOD_DECL(OnSoapOperation); 47 | TAG_METHOD_DECL(OnHttpOperation); 48 | 49 | ATTR_METHOD_DECL(OnName); 50 | 51 | inline CWSDLPortTypeOperation * GetOperation() 52 | { 53 | return m_pOperation; 54 | } 55 | 56 | inline void SetOperation(CWSDLPortTypeOperation *pOperation) 57 | { 58 | ATLASSERT( pOperation != NULL ); 59 | 60 | m_pOperation = pOperation; 61 | } 62 | 63 | HRESULT __stdcall startPrefixMapping( 64 | const wchar_t *wszPrefix, 65 | int cchPrefix, 66 | const wchar_t *wszUri, 67 | int cchUri); 68 | 69 | HRESULT OnUnrecognizedTag( 70 | const wchar_t *wszNamespaceUri, int cchNamespaceUri, 71 | const wchar_t *wszLocalName, int cchLocalName, 72 | const wchar_t *wszQName, int cchQName, 73 | ISAXAttributes *pAttributes) throw(); 74 | }; -------------------------------------------------------------------------------- /source/SProxy/WSDLParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLParser.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Parser.h" 11 | 12 | typedef NAMESPACEMAP IMPORTMAP; 13 | 14 | class CWSDLDocument; 15 | 16 | class CWSDLParser : public CParserBase 17 | { 18 | private: 19 | 20 | IMPORTMAP m_importMap; 21 | 22 | CAutoPtr m_pDocument; 23 | 24 | public: 25 | CWSDLParser(); 26 | CWSDLParser(ISAXXMLReader *pReader, CParserBase *pParent, DWORD dwLevel); 27 | 28 | // 29 | // Parsing maps 30 | // 31 | BEGIN_XMLTAG_MAP() 32 | XMLTAG_ENTRY_EX( "definitions", WSDL_NAMESPACEA, OnDefinitions ) 33 | XMLTAG_ENTRY( "import", OnImport ) 34 | XMLTAG_ENTRY_EX( "documentation", WSDL_NAMESPACEA, OnDocumentation ) 35 | XMLTAG_ENTRY_EX( "types", WSDL_NAMESPACEA, OnTypes ) 36 | XMLTAG_ENTRY_EX( "message", WSDL_NAMESPACEA, OnMessage ) 37 | XMLTAG_ENTRY_EX( "portType", WSDL_NAMESPACEA, OnPortType ) 38 | XMLTAG_ENTRY_EX( "binding", WSDL_NAMESPACEA, OnBinding ) 39 | XMLTAG_ENTRY_EX( "service", WSDL_NAMESPACEA, OnService ) 40 | END_XMLTAG_MAP() 41 | 42 | BEGIN_XMLATTR_MAP() 43 | XMLATTR_ENTRY( "name", OnName ) 44 | XMLATTR_ENTRY( "targetNamespace", OnTargetNamespace ) 45 | END_XMLATTR_MAP() 46 | 47 | // 48 | // Parse functions 49 | // 50 | TAG_METHOD_DECL( OnDefinitions ); 51 | TAG_METHOD_DECL( OnImport ); 52 | TAG_METHOD_DECL( OnDocumentation ); 53 | TAG_METHOD_DECL( OnTypes ); 54 | TAG_METHOD_DECL( OnMessage ); 55 | TAG_METHOD_DECL( OnPortType ); 56 | TAG_METHOD_DECL( OnBinding ); 57 | TAG_METHOD_DECL( OnService ); 58 | 59 | ATTR_METHOD_DECL( OnName ); 60 | ATTR_METHOD_DECL( OnTargetNamespace ); 61 | 62 | inline void SetWSDLDocument(CWSDLDocument *pDoc) 63 | { 64 | m_pDocument.Free(); 65 | m_pDocument.Attach(pDoc); 66 | } 67 | 68 | inline CWSDLDocument * GetWSDLDocument(BOOL bReleaseOwnership = FALSE) 69 | { 70 | if (m_pDocument == NULL) 71 | { 72 | CreateWSDLDocument(); 73 | } 74 | 75 | if (bReleaseOwnership != FALSE) 76 | { 77 | return m_pDocument.Detach(); 78 | } 79 | return m_pDocument; 80 | } 81 | 82 | CWSDLDocument * CreateWSDLDocument(); 83 | 84 | HRESULT __stdcall startPrefixMapping( 85 | const wchar_t *wszPrefix, 86 | int cchPrefix, 87 | const wchar_t *wszUri, 88 | int cchUri); 89 | }; -------------------------------------------------------------------------------- /source/SProxy/WSDLPort.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLPort.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | #include "WSDLPort.h" 9 | #include "WSDLDocument.h" 10 | 11 | #include "Attribute.h" 12 | #include "Content.h" 13 | #include "Element.h" 14 | #include "ComplexType.h" 15 | 16 | CWSDLBinding * CWSDLPort::GetBinding() 17 | { 18 | if (m_pBinding != NULL) 19 | { 20 | return m_pBinding; 21 | } 22 | 23 | CXMLDocument *pDoc = GetParentDocument(); 24 | if (pDoc != NULL) 25 | { 26 | CStringW strUri; 27 | if (SUCCEEDED(GetNamespaceUri(m_binding.GetPrefix(), strUri))) 28 | { 29 | if (strUri == pDoc->GetTargetNamespace()) 30 | { 31 | if (pDoc->GetDocumentType() == WSDLDOC) 32 | { 33 | CWSDLDocument *pWSDLDoc = static_cast(pDoc); 34 | m_pBinding = pWSDLDoc->GetBinding(m_binding.GetName()); 35 | if (m_pBinding == NULL) 36 | { 37 | EmitFileError(IDS_SDL_UNRESOLVED_ELEM2, const_cast(this), 0, 38 | "binding", strUri, m_binding.GetName()); 39 | } 40 | } 41 | } 42 | else 43 | { 44 | EmitFileError(IDS_SDL_UNRESOLVED_ELEM2, const_cast(this), 0, "binding", strUri, m_binding.GetName()); 45 | } 46 | } 47 | else 48 | { 49 | EmitFileError(IDS_SDL_UNRESOLVED_NAMESPACE, const_cast(this), 0, m_binding.GetPrefix()); 50 | } 51 | } 52 | 53 | return m_pBinding; 54 | } -------------------------------------------------------------------------------- /source/SProxy/WSDLPort.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLPort.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "XMLElement.h" 11 | #include "QName.h" 12 | #include "WSDLBinding.h" 13 | 14 | class CWSDLPort : public CXMLElement 15 | { 16 | private: 17 | CStringW m_strName; 18 | CQName m_binding; 19 | 20 | CStringW m_strSoapAddress; 21 | CStringW m_strHttpAddress; 22 | 23 | CWSDLBinding * m_pBinding; 24 | 25 | public: 26 | 27 | CWSDLPort(CWSDLBinding *pBinding = NULL) 28 | :m_pBinding(pBinding) 29 | { 30 | } 31 | 32 | inline HRESULT SetBinding(const CStringW& strQName) 33 | { 34 | m_binding.SetQName(strQName); 35 | return S_OK; 36 | } 37 | 38 | inline HRESULT SetBinding(const CStringW& strPrefix, const CStringW& strName) 39 | { 40 | m_binding.SetQName(strPrefix, strName); 41 | return S_OK; 42 | } 43 | 44 | inline HRESULT SetBinding(const wchar_t *wszQName, int cchQName) 45 | { 46 | m_binding.SetQName(wszQName, cchQName); 47 | return S_OK; 48 | } 49 | 50 | inline const CQName& GetBindingName() 51 | { 52 | return m_binding; 53 | } 54 | 55 | CWSDLBinding * GetBinding(); 56 | 57 | inline HRESULT SetName(const wchar_t *wszName, int cchName) 58 | { 59 | if (!wszName) 60 | { 61 | return E_FAIL; 62 | } 63 | 64 | m_strName.SetString(wszName, cchName); 65 | 66 | return S_OK; 67 | } 68 | 69 | inline HRESULT SetName(const CStringW& strName) 70 | { 71 | m_strName = strName; 72 | 73 | return S_OK; 74 | } 75 | 76 | inline const CStringW& GetName() 77 | { 78 | return m_strName; 79 | } 80 | 81 | inline HRESULT SetSoapAddress(const wchar_t *wszSoapAddress, int cchSoapAddress) 82 | { 83 | if (!wszSoapAddress) 84 | { 85 | return E_FAIL; 86 | } 87 | 88 | m_strSoapAddress.SetString(wszSoapAddress, cchSoapAddress); 89 | 90 | return S_OK; 91 | } 92 | 93 | inline HRESULT SetSoapAddress(const CStringW& strSoapAddress) 94 | { 95 | 96 | wchar_t wszTmp[ATL_URL_MAX_URL_LENGTH]; 97 | if(AtlEscapeUrl(strSoapAddress,wszTmp,0,ATL_URL_MAX_URL_LENGTH-1,ATL_URL_BROWSER_MODE) == FALSE) 98 | return E_FAIL; 99 | m_strSoapAddress = wszTmp; 100 | return S_OK; 101 | } 102 | 103 | inline const CStringW& GetSoapAddress() 104 | { 105 | return m_strSoapAddress; 106 | } 107 | 108 | inline HRESULT SetHttpAddress(const wchar_t *wszHttpAddress, int cchHttpAddress) 109 | { 110 | if (!wszHttpAddress) 111 | { 112 | return E_FAIL; 113 | } 114 | 115 | m_strHttpAddress.SetString(wszHttpAddress, cchHttpAddress); 116 | 117 | return S_OK; 118 | } 119 | 120 | inline HRESULT SetHttpAddress(const CStringW& strHttpAddress) 121 | { 122 | m_strHttpAddress = strHttpAddress; 123 | 124 | return S_OK; 125 | } 126 | 127 | inline const CStringW& GetHttpAddress() 128 | { 129 | return m_strHttpAddress; 130 | } 131 | }; -------------------------------------------------------------------------------- /source/SProxy/WSDLPortType.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLPortType.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "XMLElement.h" 11 | #include "WSDLPortTypeOperation.h" 12 | 13 | class CWSDLPortType : public CXMLElement 14 | { 15 | private: 16 | 17 | CStringW m_strDocumentation; 18 | CStringW m_strName; 19 | 20 | typedef CAtlPtrMap > PORTYPEOPERATIONMAP; 21 | 22 | PORTYPEOPERATIONMAP m_operations; 23 | 24 | public: 25 | 26 | inline CWSDLPortTypeOperation * AddOperation(CWSDLPortTypeOperation *p) 27 | { 28 | if (p != NULL) 29 | { 30 | if (p->GetName().GetLength() != 0) 31 | { 32 | if (m_operations.SetAt(p->GetName(), p) != NULL) 33 | { 34 | return p; 35 | } 36 | } 37 | } 38 | 39 | EmitErrorHr(E_OUTOFMEMORY); 40 | return NULL; 41 | } 42 | 43 | inline CWSDLPortTypeOperation * GetOperation(const CStringW& strName) 44 | { 45 | const PORTYPEOPERATIONMAP::CPair *p = m_operations.Lookup(strName); 46 | if (p != NULL) 47 | { 48 | return p->m_value; 49 | } 50 | 51 | return NULL; 52 | } 53 | 54 | inline POSITION GetFirstOperation() 55 | { 56 | return m_operations.GetStartPosition(); 57 | } 58 | 59 | inline CWSDLPortTypeOperation * GetNextOperation(POSITION &pos) 60 | { 61 | return m_operations.GetNextValue(pos); 62 | } 63 | 64 | inline HRESULT SetName(const CStringW& strName) 65 | { 66 | m_strName = strName; 67 | return S_OK; 68 | } 69 | 70 | inline HRESULT SetName(const wchar_t *wszName, int cchName) 71 | { 72 | if (!wszName) 73 | { 74 | return E_FAIL; 75 | } 76 | 77 | m_strName.SetString(wszName, cchName); 78 | 79 | return S_OK; 80 | } 81 | 82 | inline const CStringW& GetName() 83 | { 84 | return m_strName; 85 | } 86 | 87 | }; -------------------------------------------------------------------------------- /source/SProxy/WSDLPortTypeIO.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLPortTypeIO.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | #include "WSDLPortTypeIO.h" 9 | #include "WSDLMessage.h" 10 | #include "WSDLDocument.h" 11 | 12 | #include "Attribute.h" 13 | #include "Content.h" 14 | #include "Element.h" 15 | #include "ComplexType.h" 16 | 17 | CWSDLMessage * CWSDLPortTypeIO::GetMessage() 18 | { 19 | if (m_pMessage != NULL) 20 | { 21 | return m_pMessage; 22 | } 23 | 24 | CXMLDocument *pDoc = GetParentDocument(); 25 | if (pDoc != NULL) 26 | { 27 | CStringW strUri; 28 | if (SUCCEEDED(GetNamespaceUri(m_message.GetPrefix(), strUri))) 29 | { 30 | if (strUri == pDoc->GetTargetNamespace()) 31 | { 32 | if (pDoc->GetDocumentType() == WSDLDOC) 33 | { 34 | CWSDLDocument *pWSDLDoc = static_cast(pDoc); 35 | m_pMessage = pWSDLDoc->GetMessage(m_message.GetName()); 36 | if (m_pMessage == NULL) 37 | { 38 | EmitFileError(IDS_SDL_UNRESOLVED_ELEM2, const_cast(this), 0, 39 | "message", strUri, m_message.GetName()); 40 | } 41 | } 42 | } 43 | } 44 | else 45 | { 46 | EmitFileError(IDS_SDL_UNRESOLVED_NAMESPACE, const_cast(this), 0, m_message.GetPrefix()); 47 | } 48 | } 49 | 50 | return m_pMessage; 51 | } -------------------------------------------------------------------------------- /source/SProxy/WSDLPortTypeIO.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLPortTypeIO.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "XMLElement.h" 11 | #include "QName.h" 12 | #include "Emit.h" 13 | #include "WSDLSoapElement.h" 14 | 15 | class CWSDLMessage; 16 | 17 | class CWSDLPortTypeIO : public CXMLElement 18 | { 19 | private: 20 | 21 | CStringW m_strName; 22 | CQName m_message; 23 | 24 | CWSDLMessage * m_pMessage; 25 | 26 | CAutoPtr m_pSoapBody; 27 | 28 | CAtlPtrList m_headers; 29 | CAtlPtrList m_faults; 30 | 31 | public: 32 | 33 | inline CWSDLPortTypeIO() 34 | :m_pMessage(NULL) 35 | { 36 | } 37 | 38 | inline CSoapHeader * AddSoapHeader() 39 | { 40 | CAutoPtr p ( new CSoapHeader ); 41 | if (p != NULL) 42 | { 43 | if (m_headers.AddTail(p) != NULL) 44 | { 45 | return p.Detach(); 46 | } 47 | } 48 | 49 | EmitErrorHr(E_OUTOFMEMORY); 50 | return NULL; 51 | } 52 | 53 | inline CSoapHeader * AddSoapHeader(CSoapHeader *p) 54 | { 55 | if (m_headers.AddTail(p) != NULL) 56 | { 57 | return p; 58 | } 59 | 60 | EmitErrorHr(E_OUTOFMEMORY); 61 | return NULL; 62 | } 63 | 64 | inline POSITION GetFirstSoapHeader() 65 | { 66 | return m_headers.GetHeadPosition(); 67 | } 68 | 69 | inline CSoapHeader * GetNextSoapHeader(POSITION &pos) 70 | { 71 | return m_headers.GetNext(pos); 72 | } 73 | 74 | inline size_t GetNumSoapHeaders() 75 | { 76 | return m_headers.GetCount(); 77 | } 78 | 79 | inline CSoapFault * AddSoapFault() 80 | { 81 | CAutoPtr p ( new CSoapFault ); 82 | if (p != NULL) 83 | { 84 | if (m_faults.AddTail(p) != NULL) 85 | { 86 | return p.Detach(); 87 | } 88 | } 89 | 90 | EmitErrorHr(E_OUTOFMEMORY); 91 | return NULL; 92 | } 93 | 94 | inline CSoapFault * AddSoapFault(CSoapFault *p) 95 | { 96 | if (m_faults.AddTail(p) != NULL) 97 | { 98 | return p; 99 | } 100 | 101 | EmitErrorHr(E_OUTOFMEMORY); 102 | return NULL; 103 | } 104 | 105 | inline POSITION GetFirstSoapFault() 106 | { 107 | return m_faults.GetHeadPosition(); 108 | } 109 | 110 | inline CSoapFault * GetNextSoapFault(POSITION &pos) 111 | { 112 | return m_faults.GetNext(pos); 113 | } 114 | 115 | inline CSoapBody * AddSoapBody() 116 | { 117 | m_pSoapBody.Free(); 118 | m_pSoapBody.Attach( new CSoapBody ); 119 | return m_pSoapBody; 120 | } 121 | 122 | inline CSoapBody * AddSoapBody(CSoapBody *pBody) 123 | { 124 | m_pSoapBody.Free(); 125 | m_pSoapBody.Attach( pBody ); 126 | return m_pSoapBody; 127 | } 128 | 129 | inline CSoapBody * GetSoapBody() 130 | { 131 | return m_pSoapBody; 132 | } 133 | 134 | inline HRESULT SetName(const wchar_t *wszName, int cchName) 135 | { 136 | if (!wszName) 137 | { 138 | return E_FAIL; 139 | } 140 | 141 | m_strName.SetString(wszName, cchName); 142 | 143 | return S_OK; 144 | } 145 | 146 | inline HRESULT SetName(const CStringW& strName) 147 | { 148 | m_strName = strName; 149 | 150 | return S_OK; 151 | } 152 | 153 | inline const CStringW& GetName() 154 | { 155 | return m_strName; 156 | } 157 | 158 | inline HRESULT SetMessage(const CStringW& strQName) 159 | { 160 | m_message.SetQName(strQName); 161 | 162 | return S_OK; 163 | } 164 | 165 | inline HRESULT SetMessage(const CStringW& strPrefix, const CStringW& strName) 166 | { 167 | m_message.SetQName(strPrefix, strName); 168 | 169 | return S_OK; 170 | } 171 | 172 | inline HRESULT SetMessage(const wchar_t *wszQName, int cchQName) 173 | { 174 | m_message.SetQName(wszQName, cchQName); 175 | 176 | return S_OK; 177 | } 178 | 179 | inline const CQName& GetMessageName() 180 | { 181 | return m_message; 182 | } 183 | 184 | CWSDLMessage * GetMessage(); 185 | }; 186 | 187 | 188 | typedef CWSDLPortTypeIO CWSDLPortTypeInput; 189 | typedef CWSDLPortTypeIO CWSDLPortTypeOutput; 190 | typedef CWSDLPortTypeIO CWSDLPortTypeFault; -------------------------------------------------------------------------------- /source/SProxy/WSDLPortTypeParser.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLPortTypeParser.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | 9 | #include "Util.h" 10 | 11 | #include "WSDLPortTypeParser.h" 12 | #include "WSDLOperationParser.h" 13 | 14 | #include "WSDLPortType.h" 15 | #include "Attribute.h" 16 | #include "Content.h" 17 | #include "Element.h" 18 | #include "ComplexType.h" 19 | 20 | TAG_METHOD_IMPL(CWSDLPortTypeParser, OnDocumentation) 21 | { 22 | TRACE_PARSE_ENTRY(); 23 | 24 | return SkipElement(); 25 | } 26 | 27 | TAG_METHOD_IMPL(CWSDLPortTypeParser, OnOperation) 28 | { 29 | TRACE_PARSE_ENTRY(); 30 | 31 | CWSDLPortType * pCurr = GetPortType(); 32 | if (pCurr != NULL) 33 | { 34 | CAutoPtr spElem; 35 | spElem.Attach( new CWSDLPortTypeOperation ); 36 | if (spElem != NULL) 37 | { 38 | SetXMLElementInfo(spElem, pCurr, GetLocator()); 39 | CAutoPtr p( new CWSDLOperationParser(GetReader(), this, GetLevel(), spElem) ); 40 | if (p) 41 | { 42 | if (g_ParserList.AddHead(p) != NULL) 43 | { 44 | if (SUCCEEDED(p.Detach()->GetAttributes(pAttributes))) 45 | { 46 | if (pCurr->AddOperation(spElem) != NULL) 47 | { 48 | spElem.Detach(); 49 | return S_OK; 50 | } 51 | } 52 | } 53 | } 54 | } 55 | } 56 | 57 | EmitErrorHr(E_OUTOFMEMORY); 58 | 59 | return E_FAIL; 60 | } 61 | 62 | ATTR_METHOD_IMPL(CWSDLPortTypeParser, OnName) 63 | { 64 | TRACE_PARSE_ENTRY(); 65 | 66 | CWSDLPortType *pCurr = GetPortType(); 67 | if (pCurr != NULL) 68 | { 69 | return pCurr->SetName(wszValue, cchValue); 70 | } 71 | 72 | EmitError(IDS_SDL_INTERNAL); 73 | 74 | return E_FAIL; 75 | } 76 | 77 | HRESULT __stdcall CWSDLPortTypeParser::startPrefixMapping( 78 | const wchar_t *wszPrefix, 79 | int cchPrefix, 80 | const wchar_t *wszUri, 81 | int cchUri) 82 | { 83 | CWSDLPortType * pCurr = GetPortType(); 84 | if (pCurr != NULL) 85 | { 86 | return pCurr->SetNamespaceUri(wszPrefix, cchPrefix, wszUri, cchUri); 87 | } 88 | return E_FAIL; 89 | } -------------------------------------------------------------------------------- /source/SProxy/WSDLPortTypeParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLPortTypeParser.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Parser.h" 11 | 12 | class CWSDLPortType; 13 | 14 | class CWSDLPortTypeParser : public CParserBase 15 | { 16 | private: 17 | 18 | CWSDLPortType * m_pPortType; 19 | 20 | public: 21 | 22 | inline CWSDLPortTypeParser(ISAXXMLReader *pReader, CParserBase *pParent, DWORD dwLevel, CWSDLPortType * pPortType = NULL) 23 | :CParserBase(pReader, pParent, dwLevel), m_pPortType(pPortType) 24 | { 25 | } 26 | 27 | BEGIN_XMLTAG_MAP() 28 | XMLTAG_ENTRY_EX("documentation", WSDL_NAMESPACEA, OnDocumentation) 29 | XMLTAG_ENTRY_EX("operation", WSDL_NAMESPACEA, OnOperation) 30 | END_XMLTAG_MAP() 31 | 32 | BEGIN_XMLATTR_MAP() 33 | XMLATTR_ENTRY("name", OnName) 34 | END_XMLATTR_MAP() 35 | 36 | TAG_METHOD_DECL(OnDocumentation); 37 | TAG_METHOD_DECL(OnOperation); 38 | 39 | ATTR_METHOD_DECL(OnName); 40 | 41 | inline CWSDLPortType * GetPortType() 42 | { 43 | return m_pPortType; 44 | } 45 | 46 | inline void SetPortType(CWSDLPortType * pPortType) 47 | { 48 | ATLASSERT( pPortType != NULL ); 49 | 50 | m_pPortType = pPortType; 51 | } 52 | 53 | HRESULT __stdcall startPrefixMapping( 54 | const wchar_t *wszPrefix, 55 | int cchPrefix, 56 | const wchar_t *wszUri, 57 | int cchUri); 58 | }; -------------------------------------------------------------------------------- /source/SProxy/WSDLService.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLService.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "XMLElement.h" 11 | #include "WSDLPort.h" 12 | 13 | class CWSDLService : public CXMLElement 14 | { 15 | private: 16 | 17 | CStringW m_strDocumentation; 18 | CStringW m_strName; 19 | 20 | CAtlPtrList m_ports; 21 | 22 | public: 23 | 24 | inline CWSDLPort * AddPort(CWSDLPort * p = NULL) 25 | { 26 | CAutoPtr spOut; 27 | if (p == NULL) 28 | { 29 | spOut.Attach( new CWSDLPort ); 30 | p = spOut; 31 | } 32 | if (p != NULL) 33 | { 34 | if (m_ports.AddTail(p) != NULL) 35 | { 36 | spOut.Detach(); 37 | return p; 38 | } 39 | } 40 | 41 | return NULL; 42 | } 43 | 44 | POSITION GetFirstPort() 45 | { 46 | return m_ports.GetHeadPosition(); 47 | } 48 | 49 | CWSDLPort * GetNextPort(POSITION &pos) 50 | { 51 | return m_ports.GetNext(pos); 52 | } 53 | 54 | inline HRESULT SetName(const wchar_t *wszName, int cchName) 55 | { 56 | if (!wszName) 57 | { 58 | return E_FAIL; 59 | } 60 | 61 | m_strName.SetString(wszName, cchName); 62 | 63 | return S_OK; 64 | } 65 | 66 | inline HRESULT SetName(const CStringW& strName) 67 | { 68 | m_strName = strName; 69 | 70 | return S_OK; 71 | } 72 | 73 | inline const CStringW& GetName() 74 | { 75 | return m_strName; 76 | } 77 | }; -------------------------------------------------------------------------------- /source/SProxy/WSDLServiceParser.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLServiceParser.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | 9 | #include "Util.h" 10 | 11 | #include "WSDLServiceParser.h" 12 | #include "WSDLServicePortParser.h" 13 | 14 | #include "WSDLService.h" 15 | #include "Attribute.h" 16 | #include "Content.h" 17 | #include "Element.h" 18 | #include "ComplexType.h" 19 | 20 | TAG_METHOD_IMPL(CWSDLServiceParser, OnDocumentation) 21 | { 22 | TRACE_PARSE_ENTRY(); 23 | 24 | return SkipElement(); 25 | } 26 | 27 | TAG_METHOD_IMPL(CWSDLServiceParser, OnPort) 28 | { 29 | TRACE_PARSE_ENTRY(); 30 | 31 | CWSDLService *pCurr = GetService(); 32 | if (pCurr != NULL) 33 | { 34 | CWSDLPort *pElem = pCurr->AddPort(); 35 | if (pElem != NULL) 36 | { 37 | SetXMLElementInfo(pElem, pCurr, GetLocator()); 38 | 39 | CAutoPtr p( new CWSDLServicePortParser(GetReader(), this, GetLevel(), pElem) ); 40 | if (p != NULL) 41 | { 42 | if (g_ParserList.AddHead(p) != NULL) 43 | { 44 | return p.Detach()->GetAttributes(pAttributes); 45 | } 46 | } 47 | } 48 | } 49 | 50 | EmitErrorHr(E_OUTOFMEMORY); 51 | 52 | return E_FAIL; 53 | } 54 | 55 | ATTR_METHOD_IMPL(CWSDLServiceParser, OnName) 56 | { 57 | TRACE_PARSE_ENTRY(); 58 | 59 | CWSDLService * pCurr = GetService(); 60 | if (pCurr != NULL) 61 | { 62 | return pCurr->SetName(wszValue, cchValue); 63 | } 64 | 65 | EmitErrorHr(E_OUTOFMEMORY); 66 | 67 | return E_FAIL; 68 | } 69 | 70 | HRESULT __stdcall CWSDLServiceParser::startPrefixMapping( 71 | const wchar_t *wszPrefix, 72 | int cchPrefix, 73 | const wchar_t *wszUri, 74 | int cchUri) 75 | { 76 | CWSDLService * pCurr = GetService(); 77 | if (pCurr != NULL) 78 | { 79 | return pCurr->SetNamespaceUri(wszPrefix, cchPrefix, wszUri, cchUri); 80 | } 81 | return E_FAIL; 82 | } 83 | 84 | HRESULT CWSDLServiceParser::OnUnrecognizedTag( 85 | const wchar_t *wszNamespaceUri, int cchNamespaceUri, 86 | const wchar_t *wszLocalName, int cchLocalName, 87 | const wchar_t * /*wszQName*/, int /*cchQName*/, 88 | ISAXAttributes * /*pAttributes*/) throw() 89 | { 90 | CWSDLService * pCurr = GetService(); 91 | if (pCurr != NULL) 92 | { 93 | int nLine; 94 | int nCol; 95 | GetLocator()->getLineNumber(&nLine); 96 | GetLocator()->getColumnNumber(&nCol); 97 | 98 | EmitFileWarning(IDS_SDL_SKIP_EXTENSIBILITY, 99 | pCurr->GetParentDocument()->GetDocumentUri(), 100 | nLine, 101 | nCol, 102 | 0, 103 | wszNamespaceUri, 104 | wszLocalName); 105 | } 106 | return SkipElement(); 107 | } -------------------------------------------------------------------------------- /source/SProxy/WSDLServiceParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLServiceParser.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Parser.h" 11 | 12 | class CWSDLService; 13 | 14 | class CWSDLServiceParser : public CParserBase 15 | { 16 | private: 17 | 18 | CWSDLService *m_pService; 19 | 20 | public: 21 | 22 | inline CWSDLServiceParser(ISAXXMLReader *pReader, CParserBase *pParent, DWORD dwLevel, CWSDLService *pService = NULL) 23 | :CParserBase(pReader, pParent, dwLevel), m_pService(pService) 24 | { 25 | } 26 | 27 | BEGIN_XMLTAG_MAP() 28 | XMLTAG_ENTRY_EX("documentation", WSDL_NAMESPACEA, OnDocumentation) 29 | XMLTAG_ENTRY_EX("port", WSDL_NAMESPACEA, OnPort) 30 | END_XMLTAG_MAP() 31 | 32 | BEGIN_XMLATTR_MAP() 33 | XMLATTR_ENTRY("name", OnName) 34 | END_XMLATTR_MAP() 35 | 36 | TAG_METHOD_DECL(OnDocumentation); 37 | TAG_METHOD_DECL(OnPort); 38 | 39 | ATTR_METHOD_DECL(OnName); 40 | 41 | inline CWSDLService * GetService() 42 | { 43 | return m_pService; 44 | } 45 | 46 | inline void SetService(CWSDLService *pService) 47 | { 48 | ATLASSERT( pService != NULL ); 49 | 50 | m_pService = pService; 51 | } 52 | 53 | HRESULT __stdcall startPrefixMapping( 54 | const wchar_t *wszPrefix, 55 | int cchPrefix, 56 | const wchar_t *wszUri, 57 | int cchUri); 58 | 59 | HRESULT OnUnrecognizedTag( 60 | const wchar_t *wszNamespaceUri, int cchNamespaceUri, 61 | const wchar_t *wszLocalName, int cchLocalName, 62 | const wchar_t *wszQName, int cchQName, 63 | ISAXAttributes *pAttributes) throw() ; 64 | }; -------------------------------------------------------------------------------- /source/SProxy/WSDLServicePortParser.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLServicePortParser.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | 9 | #include "Util.h" 10 | 11 | #include "WSDLServicePortParser.h" 12 | 13 | #include "WSDLPort.h" 14 | #include "Attribute.h" 15 | #include "Content.h" 16 | #include "Element.h" 17 | #include "ComplexType.h" 18 | 19 | TAG_METHOD_IMPL(CWSDLServicePortParser, OnSoapAddress) 20 | { 21 | TRACE_PARSE_ENTRY(); 22 | 23 | CWSDLPort * pCurr = GetPort(); 24 | if (pCurr != NULL) 25 | { 26 | CStringW strAddress; 27 | if (S_OK == GetAttribute(pAttributes, L"location", sizeof("location")-1, strAddress)) 28 | { 29 | if (SUCCEEDED(pCurr->SetSoapAddress(strAddress))) 30 | { 31 | return SkipElement(); 32 | } 33 | } 34 | OnMissingAttribute(TRUE, L"location", sizeof("location")-1, L"", 0); 35 | } 36 | 37 | EmitError(IDS_SDL_INTERNAL); 38 | 39 | return E_FAIL; 40 | } 41 | 42 | TAG_METHOD_IMPL(CWSDLServicePortParser, OnHttpAddress) 43 | { 44 | TRACE_PARSE_ENTRY(); 45 | 46 | CWSDLPort * pCurr = GetPort(); 47 | if (pCurr != NULL) 48 | { 49 | CStringW strAddress; 50 | if (S_OK == GetAttribute(pAttributes, L"location", sizeof("location")-1, strAddress)) 51 | { 52 | if (SUCCEEDED(pCurr->SetHttpAddress(strAddress))) 53 | { 54 | return SkipElement(); 55 | } 56 | } 57 | OnMissingAttribute(TRUE, L"location", sizeof("location")-1, L"", 0); 58 | } 59 | 60 | EmitError(IDS_SDL_INTERNAL); 61 | 62 | return E_FAIL; 63 | } 64 | 65 | ATTR_METHOD_IMPL(CWSDLServicePortParser, OnName) 66 | { 67 | TRACE_PARSE_ENTRY(); 68 | 69 | CWSDLPort * pCurr = GetPort(); 70 | if (pCurr != NULL) 71 | { 72 | return pCurr->SetName(wszValue, cchValue); 73 | } 74 | 75 | EmitError(IDS_SDL_INTERNAL); 76 | 77 | return E_FAIL; 78 | } 79 | 80 | ATTR_METHOD_IMPL(CWSDLServicePortParser, OnBinding) 81 | { 82 | TRACE_PARSE_ENTRY(); 83 | 84 | CWSDLPort * pCurr = GetPort(); 85 | if (pCurr != NULL) 86 | { 87 | return pCurr->SetBinding(wszValue, cchValue); 88 | } 89 | 90 | EmitError(IDS_SDL_INTERNAL); 91 | 92 | return E_FAIL; 93 | } 94 | 95 | HRESULT __stdcall CWSDLServicePortParser::startPrefixMapping( 96 | const wchar_t *wszPrefix, 97 | int cchPrefix, 98 | const wchar_t *wszUri, 99 | int cchUri) 100 | { 101 | CWSDLPort * pCurr = GetPort(); 102 | if (pCurr != NULL) 103 | { 104 | return pCurr->SetNamespaceUri(wszPrefix, cchPrefix, wszUri, cchUri); 105 | } 106 | return E_FAIL; 107 | } 108 | 109 | HRESULT CWSDLServicePortParser::OnUnrecognizedTag( 110 | const wchar_t *wszNamespaceUri, int cchNamespaceUri, 111 | const wchar_t *wszLocalName, int cchLocalName, 112 | const wchar_t * /*wszQName*/, int /*cchQName*/, 113 | ISAXAttributes * /*pAttributes*/) throw() 114 | { 115 | CWSDLPort * pCurr = GetPort(); 116 | if (pCurr != NULL) 117 | { 118 | int nLine; 119 | int nCol; 120 | GetLocator()->getLineNumber(&nLine); 121 | GetLocator()->getColumnNumber(&nCol); 122 | 123 | EmitFileWarning(IDS_SDL_SKIP_EXTENSIBILITY, 124 | pCurr->GetParentDocument()->GetDocumentUri(), 125 | nLine, 126 | nCol, 127 | 0, 128 | wszNamespaceUri, 129 | wszLocalName); 130 | } 131 | return SkipElement(); 132 | } -------------------------------------------------------------------------------- /source/SProxy/WSDLServicePortParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLServicePortParser.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Parser.h" 11 | 12 | class CWSDLPort; 13 | 14 | class CWSDLServicePortParser : public CParserBase 15 | { 16 | private: 17 | 18 | CWSDLPort *m_pPort; 19 | 20 | public: 21 | 22 | inline CWSDLServicePortParser(ISAXXMLReader *pReader, CParserBase *pParent, DWORD dwLevel, CWSDLPort *pPort = NULL) 23 | :CParserBase(pReader, pParent, dwLevel), m_pPort(pPort) 24 | { 25 | } 26 | 27 | BEGIN_XMLTAG_MAP() 28 | XMLTAG_ENTRY_EX("address", SOAP_NAMESPACEA, OnSoapAddress) 29 | XMLTAG_ENTRY_EX("address", HTTP_NAMESPACEA, OnHttpAddress) 30 | END_XMLTAG_MAP() 31 | 32 | BEGIN_XMLATTR_MAP() 33 | XMLATTR_ENTRY("name", OnName) 34 | XMLATTR_ENTRY("binding", OnBinding) 35 | END_XMLATTR_MAP() 36 | 37 | TAG_METHOD_DECL(OnSoapAddress); 38 | TAG_METHOD_DECL(OnHttpAddress); 39 | 40 | ATTR_METHOD_DECL(OnName); 41 | ATTR_METHOD_DECL(OnBinding); 42 | 43 | inline CWSDLPort * GetPort() 44 | { 45 | return m_pPort; 46 | } 47 | 48 | inline void SetPort(CWSDLPort *pPort) 49 | { 50 | ATLASSERT( pPort != NULL ); 51 | 52 | m_pPort = pPort; 53 | } 54 | 55 | HRESULT __stdcall startPrefixMapping( 56 | const wchar_t *wszPrefix, 57 | int cchPrefix, 58 | const wchar_t *wszUri, 59 | int cchUri); 60 | 61 | HRESULT OnUnrecognizedTag( 62 | const wchar_t *wszNamespaceUri, int cchNamespaceUri, 63 | const wchar_t *wszLocalName, int cchLocalName, 64 | const wchar_t *wszQName, int cchQName, 65 | ISAXAttributes *pAttributes) throw(); 66 | }; -------------------------------------------------------------------------------- /source/SProxy/WSDLSoapElement.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLSoapElement.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | 9 | #include "WSDLSoapElement.h" 10 | #include "WSDLMessage.h" 11 | #include "WSDLDocument.h" 12 | 13 | CWSDLMessage * CWSDLSoapHeaderElement::GetMessage() 14 | { 15 | if (m_pMessage != NULL) 16 | { 17 | return m_pMessage; 18 | } 19 | 20 | CXMLDocument *pDoc = GetParentDocument(); 21 | if (pDoc != NULL) 22 | { 23 | CStringW strUri; 24 | if (SUCCEEDED(GetNamespaceUri(m_message.GetPrefix(), strUri))) 25 | { 26 | if (strUri == pDoc->GetTargetNamespace()) 27 | { 28 | if (pDoc->GetDocumentType() == WSDLDOC) 29 | { 30 | CWSDLDocument *pWSDLDoc = static_cast(pDoc); 31 | m_pMessage = pWSDLDoc->GetMessage(m_message.GetName()); 32 | if (m_pMessage == NULL) 33 | { 34 | EmitFileError(IDS_SDL_UNRESOLVED_ELEM2, const_cast(this), 0, 35 | "message", strUri, m_message.GetName()); 36 | } 37 | } 38 | } 39 | } 40 | else 41 | { 42 | EmitFileError(IDS_SDL_UNRESOLVED_NAMESPACE, const_cast(this), 0, 43 | m_message.GetPrefix()); 44 | } 45 | } 46 | 47 | return m_pMessage; 48 | } -------------------------------------------------------------------------------- /source/SProxy/WSDLType.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLType.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | #include "XMLElement.h" 9 | #include "Schema.h" 10 | 11 | class CWSDLType : public CXMLElement 12 | { 13 | private: 14 | 15 | CStringW m_strDocumentation; 16 | 17 | CAtlPtrList m_schemas; 18 | 19 | public: 20 | 21 | inline CSchema * AddSchema(CSchema * p = NULL) 22 | { 23 | CAutoPtr spOut; 24 | if (p== NULL) 25 | { 26 | spOut.Attach( new CSchema ); 27 | p = spOut; 28 | } 29 | 30 | if (p != NULL) 31 | { 32 | if (m_schemas.AddTail(p) != NULL) 33 | { 34 | spOut.Detach(); 35 | return p; 36 | } 37 | } 38 | 39 | return NULL; 40 | } 41 | 42 | inline POSITION GetFirstSchema() 43 | { 44 | return m_schemas.GetHeadPosition(); 45 | } 46 | 47 | inline CSchema * GetNextSchema(POSITION& pos) 48 | { 49 | return m_schemas.GetNext(pos); 50 | } 51 | }; -------------------------------------------------------------------------------- /source/SProxy/WSDLTypesParser.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLTypesParser.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | 9 | #include "Attribute.h" 10 | #include "Content.h" 11 | #include "Element.h" 12 | #include "ComplexType.h" 13 | 14 | #include "WSDLTypesParser.h" 15 | #include "SchemaParser.h" 16 | 17 | #include "WSDLType.h" 18 | #include "Attribute.h" 19 | #include "Content.h" 20 | #include "Element.h" 21 | #include "ComplexType.h" 22 | 23 | TAG_METHOD_IMPL(CWSDLTypesParser, OnDocumentation) 24 | { 25 | TRACE_PARSE_ENTRY(); 26 | 27 | return SkipElement(); 28 | } 29 | 30 | TAG_METHOD_IMPL(CWSDLTypesParser, OnSchema) 31 | { 32 | TRACE_PARSE_ENTRY(); 33 | 34 | CWSDLType *pCurr = GetType(); 35 | if (pCurr != NULL) 36 | { 37 | CSchema *pElem = pCurr->AddSchema(); 38 | if (pElem != NULL) 39 | { 40 | SetXMLElementInfo(pElem, pCurr, GetLocator()); 41 | 42 | CAutoPtr p( new CSchemaParser(GetReader(), this, GetLevel(), pElem) ); 43 | if (p != NULL) 44 | { 45 | if (g_ParserList.AddHead(p) != NULL) 46 | { 47 | return p.Detach()->GetAttributes(pAttributes); 48 | } 49 | } 50 | } 51 | } 52 | 53 | EmitErrorHr(E_OUTOFMEMORY); 54 | 55 | return E_FAIL; 56 | } 57 | 58 | HRESULT __stdcall CWSDLTypesParser::startPrefixMapping( 59 | const wchar_t *wszPrefix, 60 | int cchPrefix, 61 | const wchar_t *wszUri, 62 | int cchUri) 63 | { 64 | CWSDLType *pCurr = GetType(); 65 | if (pCurr != NULL) 66 | { 67 | return pCurr->SetNamespaceUri(wszPrefix, cchPrefix, wszUri, cchUri); 68 | } 69 | return E_FAIL; 70 | } 71 | 72 | HRESULT CWSDLTypesParser::OnUnrecognizedTag( 73 | const wchar_t *wszNamespaceUri, int cchNamespaceUri, 74 | const wchar_t *wszLocalName, int cchLocalName, 75 | const wchar_t * /*wszQName*/, int /*cchQName*/, 76 | ISAXAttributes * /*pAttributes*/) throw() 77 | { 78 | CWSDLType *pCurr = GetType(); 79 | if (pCurr != NULL) 80 | { 81 | int nLine; 82 | int nCol; 83 | GetLocator()->getLineNumber(&nLine); 84 | GetLocator()->getColumnNumber(&nCol); 85 | 86 | EmitFileWarning(IDS_SDL_SKIP_EXTENSIBILITY, 87 | pCurr->GetParentDocument()->GetDocumentUri(), 88 | nLine, 89 | nCol, 90 | 0, 91 | wszNamespaceUri, 92 | wszLocalName); 93 | } 94 | return SkipElement(); 95 | } -------------------------------------------------------------------------------- /source/SProxy/WSDLTypesParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // WSDLTypesParser.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Parser.h" 11 | 12 | class CWSDLType; 13 | 14 | class CWSDLTypesParser : public CParserBase 15 | { 16 | private: 17 | 18 | CWSDLType * m_pType; 19 | 20 | public: 21 | 22 | inline CWSDLTypesParser() 23 | { 24 | } 25 | 26 | inline CWSDLTypesParser(ISAXXMLReader *pReader, CParserBase *pParent, DWORD dwLevel, CWSDLType * pType = NULL) 27 | :CParserBase(pReader, pParent, dwLevel), m_pType(pType) 28 | { 29 | } 30 | 31 | inline CWSDLType * GetType() 32 | { 33 | return m_pType; 34 | } 35 | 36 | inline void SetType(CWSDLType * pType) 37 | { 38 | m_pType = pType; 39 | } 40 | 41 | BEGIN_XMLTAG_MAP() 42 | XMLTAG_ENTRY_EX("documentation", WSDL_NAMESPACEA, OnDocumentation) 43 | XMLTAG_ENTRY_EX("schema", XSD_NAMESPACEA, OnSchema) 44 | END_XMLTAG_MAP() 45 | 46 | EMPTY_XMLATTR_MAP() 47 | 48 | TAG_METHOD_DECL(OnDocumentation); 49 | TAG_METHOD_DECL(OnSchema); 50 | 51 | HRESULT __stdcall startPrefixMapping( 52 | const wchar_t *wszPrefix, 53 | int cchPrefix, 54 | const wchar_t *wszUri, 55 | int cchUri); 56 | 57 | HRESULT OnUnrecognizedTag( 58 | const wchar_t *wszNamespaceUri, int cchNamespaceUri, 59 | const wchar_t *wszLocalName, int cchLocalName, 60 | const wchar_t *wszQName, int cchQName, 61 | ISAXAttributes *pAttributes) throw(); 62 | }; -------------------------------------------------------------------------------- /source/SProxy/XMLDocParser.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // XMLDocParser.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | #include "XMLDocParser.h" 9 | #include "resource.h" 10 | 11 | CXMLDocParser::CXMLDocParser() 12 | :m_docType(UNKDOC) 13 | { 14 | } 15 | 16 | CXMLDocParser::CXMLDocParser(ISAXXMLReader *pReader, CParserBase *pParent, DWORD dwLevel) 17 | :CParserBase(pReader, pParent, dwLevel), m_docType(UNKDOC) 18 | { 19 | } 20 | 21 | TAG_METHOD_IMPL( CXMLDocParser, OnSchema ) 22 | { 23 | if (m_docType != UNKDOC && m_docType != SCHEMADOC) 24 | { 25 | ATLTRACE( _T("Not a schema document. Unknown root document tag: %.*ws\n"), cchLocalName, wszLocalName ); 26 | } 27 | return S_OK; 28 | } 29 | 30 | TAG_METHOD_IMPL( CXMLDocParser, OnDefinitions ) 31 | { 32 | if (m_docType != UNKDOC && m_docType != WSDLDOC) 33 | { 34 | ATLTRACE( _T("Not a WSDL document. Unknown root document tag: %.*ws\n"), cchLocalName, wszLocalName ); 35 | } 36 | return S_OK; 37 | } 38 | 39 | HRESULT CXMLDocParser::OnUnrecognizedTag( 40 | const wchar_t *wszNamespaceUri, int cchNamespaceUri, 41 | const wchar_t *wszLocalName, int cchLocalName, 42 | const wchar_t *wszQName, int cchQName, 43 | ISAXAttributes *pAttributes) throw() 44 | { 45 | const wchar_t *wszUrl; 46 | if (SUCCEEDED(GetReader()->getBaseURL(&wszUrl))) 47 | { 48 | EmitError(IDS_SDL_UNRECOGNIZED_DOC, wszUrl, wszNamespaceUri, wszLocalName); 49 | } 50 | 51 | return CParserBase::OnUnrecognizedTag(wszNamespaceUri, cchNamespaceUri, 52 | wszLocalName, cchLocalName, 53 | wszQName, cchQName, 54 | pAttributes); 55 | } -------------------------------------------------------------------------------- /source/SProxy/XMLDocParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // XMLDocParser.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "Parser.h" 11 | #include "XMLDocument.h" 12 | 13 | class CXMLDocParser : public CParserBase 14 | { 15 | XMLDOCTYPE m_docType; 16 | 17 | public: 18 | 19 | CXMLDocParser(); 20 | CXMLDocParser(ISAXXMLReader *pReader, CParserBase *pParent, DWORD dwLevel); 21 | 22 | BEGIN_XMLTAG_MAP() 23 | XMLTAG_ENTRY_EX("schema", XSD_NAMESPACEA, OnSchema) 24 | XMLTAG_ENTRY_EX("definitions", WSDL_NAMESPACEA, OnDefinitions) 25 | END_XMLTAG_MAP() 26 | 27 | TAG_METHOD_DECL( OnSchema ); 28 | TAG_METHOD_DECL( OnDefinitions ); 29 | 30 | inline void SetExpectingDocType(XMLDOCTYPE docType) 31 | { 32 | m_docType = docType; 33 | } 34 | 35 | // 36 | // override OnUnrecognizedTag 37 | // 38 | HRESULT OnUnrecognizedTag( 39 | const wchar_t *wszNamespaceUri, int cchNamespaceUri, 40 | const wchar_t *wszLocalName, int cchLocalName, 41 | const wchar_t *wszQName, int cchQName, 42 | ISAXAttributes *pAttributes) throw(); 43 | }; -------------------------------------------------------------------------------- /source/SProxy/XMLDocument.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // XMLDocument.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | #include "XMLDocument.h" 9 | #include "Emit.h" 10 | 11 | CXMLDocument::~CXMLDocument() 12 | { 13 | } 14 | 15 | CXMLDocument::CXMLDocument(XMLDOCTYPE docType) 16 | :m_docType(docType) 17 | { 18 | } 19 | 20 | BOOL CXMLDocument::AddDocument(const CStringW& strUri, CXMLDocument *pDoc) 21 | { 22 | // 23 | // always try to add to the parent if possible 24 | // 25 | CXMLDocument * pParentDocument = GetParentDocument(); 26 | if (pParentDocument != NULL) 27 | { 28 | return pParentDocument->AddDocument(strUri, pDoc); 29 | } 30 | 31 | if (m_docMap.SetAt(strUri, pDoc) != NULL) 32 | { 33 | return TRUE; 34 | } 35 | else 36 | { 37 | EmitErrorHr(E_OUTOFMEMORY); 38 | return FALSE; 39 | } 40 | } 41 | 42 | BOOL CXMLDocument::AddDocument(LPCWSTR wszUri, int cchUri, CXMLDocument *pDoc) 43 | { 44 | CStringW strUri; 45 | strUri.SetString(wszUri, cchUri); 46 | 47 | return AddDocument(strUri, pDoc); 48 | } 49 | 50 | 51 | CXMLDocument * CXMLDocument::GetDocument(const CStringW& strUri) 52 | { 53 | CXMLDocument *pDoc = NULL; 54 | const XMLDOCMAP::CPair *p = m_docMap.Lookup(strUri); 55 | if (p != NULL) 56 | { 57 | pDoc = const_cast(p)->m_value; 58 | } 59 | else 60 | { 61 | CXMLDocument * pParentDocument = GetParentDocument(); 62 | if (pParentDocument != NULL) 63 | { 64 | pDoc = pParentDocument->GetDocument(strUri); 65 | } 66 | } 67 | 68 | return pDoc; 69 | } 70 | 71 | CXMLDocument * CXMLDocument::GetDocument(LPCWSTR wszUri, int cchUri) 72 | { 73 | CStringW strUri; 74 | strUri.SetString(wszUri, cchUri); 75 | 76 | return GetDocument(strUri); 77 | } -------------------------------------------------------------------------------- /source/SProxy/XMLDocument.h: -------------------------------------------------------------------------------- 1 | // 2 | // XMLDocument.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "XMLElement.h" 11 | 12 | enum XMLDOCTYPE 13 | { 14 | // 15 | // generic (unknown) document type 16 | // 17 | UNKDOC = 1, 18 | 19 | // 20 | // XML schema document 21 | // 22 | SCHEMADOC, 23 | 24 | // 25 | // WSDL document 26 | // 27 | WSDLDOC, 28 | 29 | // 30 | // DiscoMap document 31 | DMDOC 32 | }; 33 | 34 | class CXMLDocument; 35 | typedef CAtlPtrMap > XMLDOCMAP; 36 | 37 | class CXMLDocument : public CXMLElement 38 | { 39 | private: 40 | 41 | XMLDOCTYPE m_docType; 42 | CStringW m_strDocumentUri; 43 | CStringW m_strTargetNamespace; 44 | 45 | // 46 | // mapping of URI's to CXMLDocuments 47 | // 48 | XMLDOCMAP m_docMap; 49 | 50 | public: 51 | virtual ~CXMLDocument() = 0; 52 | CXMLDocument(XMLDOCTYPE docType = UNKDOC); 53 | 54 | BOOL AddDocument(const CStringW& strUri, CXMLDocument *pDoc); 55 | BOOL AddDocument(LPCWSTR wszUri, int cchUri, CXMLDocument *pDoc); 56 | CXMLDocument * GetDocument(const CStringW& strUri); 57 | CXMLDocument * GetDocument(LPCWSTR wszUri, int cchUri); 58 | 59 | inline void SetDocumentType(XMLDOCTYPE docType) 60 | { 61 | m_docType = docType; 62 | } 63 | 64 | inline XMLDOCTYPE GetDocumentType() 65 | { 66 | return m_docType; 67 | } 68 | 69 | inline HRESULT SetTargetNamespace(const wchar_t *wszTargetNamespace, int cchTargetNamespace) 70 | { 71 | if (!wszTargetNamespace) 72 | { 73 | return E_FAIL; 74 | } 75 | 76 | m_strTargetNamespace.SetString(wszTargetNamespace, cchTargetNamespace); 77 | 78 | return S_OK; 79 | } 80 | 81 | inline HRESULT SetTargetNamespace(const CStringW& strTargetNamespace) 82 | { 83 | m_strTargetNamespace = strTargetNamespace; 84 | 85 | return S_OK; 86 | } 87 | 88 | inline const CStringW& GetTargetNamespace() 89 | { 90 | return m_strTargetNamespace; 91 | } 92 | 93 | inline HRESULT SetDocumentUri(const wchar_t *wszDocumentUri, int cchDocumentUri) 94 | { 95 | if (!wszDocumentUri) 96 | { 97 | return E_FAIL; 98 | } 99 | 100 | m_strDocumentUri.SetString(wszDocumentUri, cchDocumentUri); 101 | 102 | return S_OK; 103 | } 104 | 105 | inline HRESULT SetDocumentUri(const CStringW& strDocumentUri) 106 | { 107 | m_strDocumentUri = strDocumentUri; 108 | 109 | return S_OK; 110 | } 111 | 112 | inline const CStringW& GetDocumentUri() 113 | { 114 | return m_strDocumentUri; 115 | } 116 | }; -------------------------------------------------------------------------------- /source/SProxy/XMLElement.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // XMLElement.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #include "stdafx.h" 8 | #include "XMLElement.h" 9 | #include "XMLDocument.h" 10 | #include "Emit.h" 11 | 12 | HRESULT CXMLElement::GetNamespaceUri(const CStringW &strPrefix, CStringW &strUri) 13 | { 14 | if (m_namespaceMap.Lookup(strPrefix, strUri)) 15 | { 16 | return S_OK; 17 | } 18 | 19 | if (m_pParentElement != NULL) 20 | { 21 | return m_pParentElement->GetNamespaceUri(strPrefix, strUri); 22 | } 23 | 24 | return E_FAIL; 25 | } 26 | 27 | LPCWSTR CXMLElement::GetNamespaceUri(LPCWSTR wszPrefix, int cchPrefix) 28 | { 29 | if (cchPrefix == -1) 30 | { 31 | cchPrefix = (int)wcslen(wszPrefix); 32 | } 33 | 34 | CStringW strUri(wszPrefix, cchPrefix); 35 | 36 | CStringW strRet; 37 | if (SUCCEEDED(GetNamespaceUri(strUri, strRet))) 38 | { 39 | return (LPCWSTR) strRet; 40 | } 41 | return NULL; 42 | } 43 | 44 | HRESULT CXMLElement::SetNamespaceUri(const CStringW& strPrefix, CStringW &strUri) 45 | { 46 | if (m_namespaceMap.SetAt(strPrefix, strUri) != NULL) 47 | { 48 | return S_OK; 49 | } 50 | EmitErrorHr(E_OUTOFMEMORY); 51 | return E_FAIL; 52 | } 53 | 54 | HRESULT CXMLElement::SetNamespaceUri(LPCWSTR wszPrefix, int cchPrefix, LPCWSTR wszUri, int cchUri) 55 | { 56 | if (cchPrefix == -1) 57 | { 58 | cchPrefix = (int)wcslen(wszPrefix); 59 | } 60 | CStringW strPrefix(wszPrefix, cchPrefix); 61 | 62 | if (cchUri == -1) 63 | { 64 | cchUri = (int)wcslen(wszUri); 65 | } 66 | CStringW strUri(wszUri, cchUri); 67 | 68 | return SetNamespaceUri(strPrefix, strUri); 69 | } -------------------------------------------------------------------------------- /source/SProxy/XMLElement.h: -------------------------------------------------------------------------------- 1 | // 2 | // XMLElement.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | 11 | class CXMLDocument; 12 | 13 | // TODO: set locator information for each element 14 | struct LOCATORINFO 15 | { 16 | int nLine; 17 | int nCol; 18 | 19 | LOCATORINFO() 20 | :nLine(0), nCol(0) 21 | { 22 | } 23 | }; 24 | 25 | class CXMLElement 26 | { 27 | private: 28 | 29 | CXMLDocument * m_pParentDocument; 30 | CXMLElement * m_pParentElement; 31 | NAMESPACEMAP m_namespaceMap; 32 | LOCATORINFO m_locInfo; 33 | 34 | public: 35 | virtual ~CXMLElement() = 0 {}; 36 | 37 | inline CXMLElement(CXMLDocument *pDoc = NULL, CXMLElement * pParentElement = NULL) 38 | :m_pParentDocument(pDoc), m_pParentElement(pParentElement) 39 | { 40 | } 41 | 42 | inline CXMLElement * GetParentElement() 43 | { 44 | return m_pParentElement; 45 | } 46 | 47 | inline void SetParentElement(CXMLElement * pParentElement) 48 | { 49 | m_pParentElement = pParentElement; 50 | } 51 | 52 | inline CXMLDocument * GetParentDocument() 53 | { 54 | return m_pParentDocument; 55 | } 56 | 57 | void SetParentDocument(CXMLDocument *pDoc) 58 | { 59 | m_pParentDocument = pDoc; 60 | } 61 | 62 | void SetLineNumber(int nLine) 63 | { 64 | m_locInfo.nLine = nLine; 65 | } 66 | 67 | void SetColumnNumber(int nCol) 68 | { 69 | m_locInfo.nCol = nCol; 70 | } 71 | 72 | int GetLineNumber() 73 | { 74 | return m_locInfo.nLine; 75 | } 76 | 77 | int GetColumnNumber() 78 | { 79 | return m_locInfo.nCol; 80 | } 81 | 82 | HRESULT GetNamespaceUri(const CStringW &strPrefix, CStringW &strUri); 83 | LPCWSTR GetNamespaceUri(LPCWSTR wszPrefix, int cchPrefix = -1); 84 | HRESULT SetNamespaceUri(const CStringW& strPrefix, CStringW &strUri); 85 | HRESULT SetNamespaceUri(LPCWSTR wszPrefix, int cchPrefix, LPCWSTR wszUri, int cchUri); 86 | }; -------------------------------------------------------------------------------- /source/SProxy/XSDElement.h: -------------------------------------------------------------------------------- 1 | // 2 | // XSDElement.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include "stdafx.h" 10 | #include "XMLElement.h" 11 | #include "XSDMappingTable.h" 12 | #include "Emit.h" 13 | 14 | enum XSDELEMENT_TYPE 15 | { 16 | XSD_UNK = 0, 17 | 18 | XSD_ERR = 1, 19 | 20 | // 21 | // Permits the elements in the group to appear (or not appear) 22 | // in any order in the containing element. 23 | // 24 | XSD_ALL = 2, 25 | 26 | // 27 | // Enables any element from the specified namespace(s) 28 | // to appear in the containing complexType, sequence, or choice element. 29 | // 30 | XSD_ANY, 31 | 32 | // 33 | // Enables any attribute from the specified namespace(s) 34 | // to appear in the containing complexType element. 35 | // 36 | XSD_ANYATTRIBUTE, 37 | 38 | // 39 | // Defines an annotation. 40 | // 41 | XSD_ANNOTATION, 42 | 43 | // 44 | // Specifies information to be used by applications 45 | // within an annotation. 46 | // 47 | XSD_APPINFO, 48 | 49 | // 50 | // Declares an attribute. 51 | // 52 | XSD_ATTRIBUTE, 53 | 54 | // 55 | // Groups a set of attribute declarations so that they 56 | // can be incorporated as a group into complex type definitions. 57 | // 58 | XSD_ATTRIBUTEGROUP, 59 | 60 | // 61 | // Permits one and only one of the elements contained in the group 62 | // to be present within the containing element. 63 | // 64 | XSD_CHOICE, 65 | 66 | // 67 | // Defines a complex type, which determines the set of attributes 68 | // and the content of an element. 69 | // 70 | XSD_COMPLEXTYPE, 71 | 72 | // 73 | // Specifies information to be read by or used by humans 74 | // within an annotation. 75 | // 76 | XSD_DOCUMENTATION, 77 | 78 | // 79 | // Declares an element. 80 | // 81 | XSD_ELEMENT, 82 | 83 | // 84 | // Specifies an XPATH expression that specifies value 85 | // (or one of the values) used to enforce an identity 86 | // constraint (unique, key, keyref). 87 | // 88 | XSD_FIELD, 89 | 90 | // 91 | // Groups a set of element declarations so that they can 92 | // be incorporated as a group into complex type definitions. 93 | // 94 | XSD_GROUP, 95 | 96 | // 97 | // Identifies a namespace whose schema components are referenced 98 | // by the containing schema. 99 | // 100 | XSD_IMPORT, 101 | 102 | // 103 | // Includes the specified schema document in the targetNamespace 104 | // of the containing schema. 105 | // 106 | XSD_INCLUDE, 107 | 108 | // 109 | // Specifies that an attribute or element value (or set of values) 110 | // must be a key within the specified scope. A key must be unique, 111 | // non-nullable, and always present. 112 | // 113 | XSD_KEY, 114 | 115 | // 116 | // Specifies that an attribute or element value (or set of values) 117 | // have a correspondence with those of the specified key or unique element. 118 | // 119 | XSD_KEYREF, 120 | 121 | // 122 | // Contains the definition of a schema. 123 | // 124 | XSD_SCHEMA, 125 | 126 | // 127 | // Specifies an XPATH expression that selects a set of elements for an 128 | // identity constraint (unique, key, keyref). 129 | // 130 | XSD_SELECTOR, 131 | 132 | // 133 | // Requires the elements in the group to appear in the specified sequence 134 | // within the containing element. 135 | // 136 | XSD_SEQUENCE, 137 | 138 | // 139 | // Defines a simple type, which determines the constraints on and 140 | // information about the values of attributes or elements with 141 | // text-only content. 142 | // 143 | XSD_SIMPLETYPE, 144 | 145 | // 146 | // Specifies that an attribute or element value (or set of values) 147 | // must be unique within the specified scope. 148 | // 149 | XSD_UNIQUE, 150 | 151 | XSD_COMPLEXCONTENT, 152 | XSD_SIMPLECONTENT, 153 | XSD_RESTRICTION, 154 | XSD_EXTENSION, 155 | 156 | XSD_UNSUPPORTED 157 | }; 158 | 159 | class CSchema; 160 | 161 | class CXSDElement : public CXMLElement 162 | { 163 | private: 164 | 165 | XSDELEMENT_TYPE m_elementType; 166 | CSchema * m_pParentSchema; 167 | 168 | public: 169 | 170 | CXSDElement(CXMLElement * pParentElement = NULL, XSDELEMENT_TYPE elementType = XSD_UNK) 171 | :m_elementType(elementType) 172 | { 173 | SetParentElement(pParentElement); 174 | } 175 | 176 | inline XSDELEMENT_TYPE GetElementType() 177 | { 178 | return m_elementType; 179 | } 180 | 181 | inline void SetElementType(XSDELEMENT_TYPE elementType) 182 | { 183 | m_elementType = elementType; 184 | } 185 | 186 | inline CSchema * GetParentSchema() 187 | { 188 | return m_pParentSchema; 189 | } 190 | 191 | inline void SetParentSchema(CSchema * pParentSchema) 192 | { 193 | m_pParentSchema = pParentSchema; 194 | } 195 | }; 196 | 197 | // XSD Mapping table 198 | extern const __declspec(selectany) CXSDTypeLookup g_xsdLookup; 199 | 200 | inline HRESULT GetXSDType(const CStringW& strUri, const CStringW& strName, XSDTYPE *pXSD) 201 | { 202 | ATLASSERT( pXSD != NULL ); 203 | *pXSD = XSDTYPE_ERR; 204 | if (strUri == XSD_NAMESPACEW) 205 | { 206 | const CXSDTypeLookup::HashNode *pNode = g_xsdLookup.Lookup(strName); 207 | if (pNode != NULL) 208 | { 209 | *pXSD = pNode->data.xsdType; 210 | return S_OK; 211 | } 212 | else // (pNode == NULL) 213 | { 214 | EmitError(IDS_SDL_UNRESOLVED_ELEM, strUri, strName); 215 | return E_FAIL; 216 | } 217 | } 218 | 219 | return S_FALSE; 220 | } -------------------------------------------------------------------------------- /source/SProxy/XSDMappingTable.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabegundy/atlserver/e2f585fc7e073f7195564be86717e3faec79346e/source/SProxy/XSDMappingTable.h -------------------------------------------------------------------------------- /source/SProxy/cppkeywords.in: -------------------------------------------------------------------------------- 1 | %class=CCppKeywordLookup 2 | %preamble 3 | // 4 | // generated with VC7Libs\Nonship\Src\Sproxy2\static_hash\static_hash /i cppkeywords.in /o CppKeywordTable.h /w 5 | // 6 | 7 | %type=char 8 | %data 9 | auto,0 10 | break,0 11 | case,0 12 | char,0 13 | const,0 14 | continue,0 15 | default,0 16 | do,0 17 | double,0 18 | else,0 19 | enum,0 20 | extern,0 21 | float,0 22 | for,0 23 | goto,0 24 | if,0 25 | int,0 26 | long,0 27 | register,0 28 | return,0 29 | short,0 30 | signed,0 31 | sizeof,0 32 | static,0 33 | struct,0 34 | switch,0 35 | typedef,0 36 | union,0 37 | unsigned,0 38 | void,0 39 | volatile,0 40 | while,0 41 | __inline,0 42 | __cdecl,0 43 | __based,0 44 | __compileBreak,0 45 | __feacpBreak,0 46 | __pragma,0 47 | __stdcall,0 48 | __declspec,0 49 | asm,0 50 | catch,0 51 | class,0 52 | const_cast,0 53 | delete,0 54 | dynamic_cast,0 55 | __try_cast,0 56 | explicit,0 57 | friend,0 58 | inline,0 59 | mutable,0 60 | namespace,0 61 | new,0 62 | operator,0 63 | private,0 64 | protected,0 65 | public,0 66 | reinterpret_cast,0 67 | static_cast,0 68 | template,0 69 | this,0 70 | throw,0 71 | try,0 72 | typeid,0 73 | typename,0 74 | using,0 75 | virtual,0 76 | __single_inheritance,0 77 | __multiple_inheritance,0 78 | __virtual_inheritance,0 79 | __novtordisp,0 80 | __uuidof,0 81 | __resume,0 82 | __nounwind,0 83 | __thiscall,0 84 | cdecl,0 85 | __try,0 86 | __except,0 87 | __finally,0 88 | __finally,0 89 | __leave,0 90 | __asm,0 91 | __fastcall,0 92 | __unaligned,0 93 | __alignof,0 94 | __builtin_alignof,0 95 | __builtin_isfloat,0 96 | __wchar_t,0 97 | __restrict,0 98 | __ptr64,0 99 | __ptr32,0 100 | __w64,0 101 | __nontemporal,0 102 | __probability,0 103 | __nodefault,0 104 | __forceinline,0 105 | __assume,0 106 | __int8,0 107 | __int16,0 108 | __int32,0 109 | __int64,0 110 | __int128,0 111 | wchar_t,0 112 | wchar_t,0 113 | and,0 114 | and_eq,0 115 | bitand,0 116 | or,0 117 | or_eq,0 118 | bitor,0 119 | xor,0 120 | xor_eq,0 121 | compl,0 122 | not,0 123 | not_eq,0 124 | bool,0 125 | true,0 126 | false,0 127 | bool,0 128 | true,0 129 | false,0 130 | __property,0 131 | __interface,0 132 | __sealed,0 133 | __abstract,0 134 | __super,0 135 | __value,0 136 | __event,0 137 | __raise,0 138 | __hook,0 139 | __unhook,0 140 | __delegate,0 141 | __gc,0 142 | __nogc,0 143 | __pin,0 144 | __box,0 145 | __identifier,0 146 | __typeof,0 147 | __if_exists,0 148 | __if_not_exists,0 149 | __CURSOR__,0 150 | __LINE__,0 151 | __FILE__,0 152 | __DATE__,0 153 | __TIME__,0 154 | __TIMESTAMP__,0 155 | __FUNCTION__,0 156 | __FUNCDNAME__,0 157 | __FUNCSIG__,0 158 | __FSTREXP,0 159 | __LPREFIX,0 160 | __APREFIX,0 161 | __SPREFIX,0 162 | __cplusplus,0 163 | __BOOL_DEFINED,0 164 | __STDC__,0 165 | _WCHAR_T_DEFINED,0 166 | _NATIVE_WCHAR_T_DEFINED,0 167 | _WCHAR_T_DEFINED,0 168 | __COUNTER__,0 169 | -------------------------------------------------------------------------------- /source/SProxy/facets.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabegundy/atlserver/e2f585fc7e073f7195564be86717e3faec79346e/source/SProxy/facets.in -------------------------------------------------------------------------------- /source/SProxy/makefile: -------------------------------------------------------------------------------- 1 | # 2 | # DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source 3 | # file to this component. This file merely indirects to the real make file 4 | # that is shared by all the components of Visual Studio. 5 | # 6 | !INCLUDE $(NTMAKEENV)\devdiv.def 7 | !INCLUDE makefile.inc 8 | -------------------------------------------------------------------------------- /source/SProxy/makefile.inc: -------------------------------------------------------------------------------- 1 | !IF 0 2 | 3 | Copyright (c) 1990-2003 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | makefile.inc. 8 | 9 | Abstract: 10 | 11 | This file specifies build commands for the component in each phase. 12 | 13 | !ENDIF 14 | 15 | !include $(VCBASE)\makefile.inc 16 | !include $(VCBASE)\vc7libs\makefile.inc 17 | 18 | !if defined(NO_AUTOMATIC_MANIFEST) && "$(NO_AUTOMATIC_MANIFEST)" != "0" 19 | _LINK_=/manifest:no 20 | !else 21 | # enable manifest file generation and embedding. 22 | _LINK_=$(_LINK_:/manifest:no=) 23 | _LINK_=$(_LINK_:-manifest:no=) 24 | !endif 25 | 26 | BOOT_PHASE SELF_PHASE: 27 | 28 | PROD_PHASE: 29 | set _LINK_=$(_LINK_) 30 | $(MAKE) /nologo /$(MAKEFLAGS) /f Sproxy.mak UNICODE=0 DEBUG=0 $(_ATLMFC_CLEAN) "SECURE_CRT_DEPRECATE=$(SECURE_CRT_DEPRECATE)" 31 | !ifndef _ATLMFC_CLEAN 32 | -if not exist $(BINPATH) mkdir $(BINPATH) 33 | copy $(PLATFORM)\Release\sproxy.exe $(BINPATH) 34 | copy $(PLATFORM)\Release\sproxy.pdb $(BINPATH) 35 | -if not exist $(BINPATH)\1033 mkdir $(BINPATH)\1033 36 | copy $(PLATFORM)\Release\1033\sproxyUI.dll $(BINPATH)\1033 37 | 38 | !endif 39 | -------------------------------------------------------------------------------- /source/SProxy/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by sproxy.rc 4 | // 5 | // Copyright (c) Microsoft Corporation. All rights reserved. 6 | // 7 | #define IDR_SPROXYSRF 101 8 | #define IDR_SRF1 102 9 | #define IDS_SDL_HEADER 103 10 | #define IDS_SDL_SUCCESS 104 11 | #define IDS_SDL_USAGE 105 12 | #define IDS_SDL_PROCESS_FAILURE 106 13 | #define IDS_SDL_GENERATE_FAILURE 107 14 | #define IDS_SDL_INTERNAL 108 15 | #define IDS_SDL_PARSE_WARNING 109 16 | #define IDS_SDL_PARSE_ERROR 110 17 | #define IDS_SDL_UNRECOGNIZED_TAG 111 18 | #define IDS_SDL_MISSING_ATTRIBUTE 112 19 | #define IDS_SDL_MSXML 113 20 | #define IDS_SDL_UNRECOGNIZED_DOC 114 21 | #define IDS_SDL_UNRESOLVED_ELEM 115 22 | #define IDS_SDL_UNRESOLVED_NAMESPACE 116 23 | #define IDS_SDL_LITERAL_ONLY 117 24 | #define IDS_SDL_ONE_PORT 118 25 | #define IDS_SDL_UNSUPPORTED_TAG 119 26 | #define IDS_SDL_CMDLINE_FAILURE 120 27 | #define IDS_SDL_UNRESOLVED_ELEM2 123 28 | #define IDS_SDL_INVALID_VALUE 124 29 | #define IDS_SDL_SOAP_PORT_ONLY 125 30 | #define IDS_SDL_SOAP_BINDING_ONLY 126 31 | #define IDS_SDL_INVALID_ARRAY_DESC 127 32 | #define IDS_SDL_UNSUPPORTED_STRING 128 33 | #define IDS_SDL_RECURSIVE_TYPE 129 34 | #define IDS_SDL_IGNORE_CMDITEM 130 35 | #define IDS_SDL_MISSING_OPTION 131 36 | #define IDS_SDL_FAILED_WSDL_OPEN 132 37 | #define IDS_SDL_UNRESOLVED_MSGPART 133 38 | #define IDS_SDL_SOAPHEADER_DUPNAME 134 39 | #define IDS_SDL_USAGE_EX 135 40 | #define IDS_SDL_CMDLINE 136 41 | #define IDS_SDL_PARSE 137 42 | #define IDS_SDL_SCHEMALEVEL_NAME 138 43 | #define IDS_SDL_PAD_TYPE 139 44 | #define IDS_SDL_PAD_INVALID_SOAP 140 45 | #define IDS_SDL_RPC_ENCODED_TYPE 141 46 | #define IDS_SDL_DOC_ENCODED 142 47 | #define IDS_SDL_ENCODINGSTYLE 143 48 | #define IDS_SDL_SKIP_EXTENSIBILITY 144 49 | #define IDS_SDL_IO_DIFF_NAMESPACES 145 50 | #define IDS_SDL_RPC_LITERAL 146 51 | #define IDS_SDL_HEADER_DIFF_NAMESPACES 147 52 | #define IDS_SDL_INVALID_ARRAY_DESC_ERR 148 53 | #define IDS_SDL_NO_GENERATE 149 54 | #define IDS_SDL_CUSTOM_TYPE 150 55 | #define IDS_SDL_BASE_EXTENSION 151 56 | #define IDS_SDL_NO_ATTRIBUTES 152 57 | #define IDS_SDL_FAILED_DM_OPEN 153 58 | #define IDS_SDL_PROCESS_DM_FAILURE 154 59 | #define IDS_SDL_DEFAULT_TYPE 155 60 | // Next default values for new objects 61 | // 62 | #ifdef APSTUDIO_INVOKED 63 | #ifndef APSTUDIO_READONLY_SYMBOLS 64 | #define _APS_NEXT_RESOURCE_VALUE 156 65 | #define _APS_NEXT_COMMAND_VALUE 40001 66 | #define _APS_NEXT_CONTROL_VALUE 1001 67 | #define _APS_NEXT_SYMED_VALUE 102 68 | #endif 69 | #endif 70 | -------------------------------------------------------------------------------- /source/SProxy/sources: -------------------------------------------------------------------------------- 1 | !IF 0 2 | 3 | Copyright (c) 1990-1998 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | sources. 8 | 9 | Abstract: 10 | 11 | This file specifies the target component being built and the list of 12 | sources files needed to build that component. Also specifies optional 13 | compiler switches and libraries that are unique for the component being 14 | built. 15 | 16 | !ENDIF 17 | 18 | # Turn on Secure CRT deprecation 19 | CRT_SECURE_DEPRECATE=1 20 | 21 | !include ..\..\..\..\sources.inc 22 | 23 | TARGETNAME= 24 | TARGETTYPE=NOTARGET 25 | TARGETPATH= 26 | 27 | SOURCES= 28 | 29 | MISCFILES= 30 | 31 | NO_BROWSER_FILE=1 32 | -------------------------------------------------------------------------------- /source/SProxy/sproxy.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 9.00 2 | # Visual Studio 2005 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sproxy", "sproxy.vcproj", "{30A69F38-DD6A-4E97-BE7D-8899307AF81B}" 4 | EndProject 5 | Global 6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 7 | Debug|Win32 = Debug|Win32 8 | Release|Win32 = Release|Win32 9 | EndGlobalSection 10 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 11 | {30A69F38-DD6A-4E97-BE7D-8899307AF81B}.Debug|Win32.ActiveCfg = Debug|Win32 12 | {30A69F38-DD6A-4E97-BE7D-8899307AF81B}.Debug|Win32.Build.0 = Debug|Win32 13 | {30A69F38-DD6A-4E97-BE7D-8899307AF81B}.Release|Win32.ActiveCfg = Release|Win32 14 | {30A69F38-DD6A-4E97-BE7D-8899307AF81B}.Release|Win32.Build.0 = Release|Win32 15 | EndGlobalSection 16 | GlobalSection(SolutionProperties) = preSolution 17 | HideSolutionNode = FALSE 18 | EndGlobalSection 19 | EndGlobal 20 | -------------------------------------------------------------------------------- /source/SProxy/utils/cppkw.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * cppkw.c 4 | * 5 | * generate the cppkeywords.in file 6 | * this will include all reserved macros in 7 | * addition to all reserved keywords 8 | * 9 | */ 10 | // 11 | // Copyright (c) Microsoft Corporation. All rights reserved. 12 | // 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | // usage : cppkw 19 | int main(int argc, char *argv[]) 20 | { 21 | char *szRoot; 22 | char *szData; 23 | char *szTemp; 24 | char *szEnd; 25 | FILE *fpIn; 26 | FILE *fpOut; 27 | int nRet; 28 | long nFileLength = 0; 29 | 30 | 31 | nRet = 0; 32 | szRoot = NULL; 33 | szData = NULL; 34 | szTemp = NULL; 35 | szEnd = NULL; 36 | fpIn = NULL; 37 | fpOut = NULL; 38 | 39 | 40 | if (argc < 4) 41 | { 42 | printf("usage : cppkw \n"); 43 | return 1; 44 | } 45 | 46 | fpIn = fopen(argv[1], "r"); 47 | if (!fpIn) 48 | { 49 | printf("error : could not open keywdat file \"%s\"\n", argv[1]); 50 | return 1; 51 | } 52 | 53 | fpOut = fopen(argv[3], "w"); 54 | if (!fpOut) 55 | { 56 | printf("error : could not open output file \"%s\" for writing\n", argv[3]); 57 | goto error; 58 | } 59 | 60 | fprintf(fpOut, 61 | "%%class=CCppKeywordLookup\r\n" 62 | "%%preamble\r\n" 63 | "//\r\n" 64 | "// generated with VC7Libs\\Nonship\\Src\\Sproxy2\\static_hash\\static_hash /i cppkeywords.in /o CppKeywordTable.h /w\r\n" 65 | "//\r\n" 66 | "\r\n" 67 | "%%type=char\r\n" 68 | "%%data\r\n"); 69 | 70 | nFileLength = _filelength(_fileno(fpIn)); 71 | 72 | szData = (char *)malloc(nFileLength+1); 73 | if (!szData) 74 | { 75 | printf("out of memory\n"); 76 | goto error; 77 | } 78 | fread(szData, nFileLength, 1, fpIn); 79 | szData[nFileLength] = '\0'; 80 | szTemp = szRoot = szData; 81 | szEnd = szData+nFileLength; 82 | szTemp = strstr(szTemp, "\nDAT(\""); 83 | 84 | while (szTemp != NULL) 85 | { 86 | char *szTemp2 = NULL; 87 | szData = szTemp; 88 | szData+= sizeof("\nDAT(\"")-1; 89 | if (szData >= szEnd) 90 | { 91 | printf("error in (expected) format of keywdat file.\n"); 92 | goto error; 93 | } 94 | 95 | szTemp2 = strchr(szData, '"'); 96 | if (!szTemp2) 97 | { 98 | printf("error in (expected) format of keywdat file.\n"); 99 | goto error; 100 | } 101 | 102 | fprintf(fpOut, "%.*s,0\r\n", szTemp2-szData, szData); 103 | 104 | szTemp = strstr(szTemp+1, "\nDAT(\""); 105 | } 106 | 107 | fclose(fpIn); 108 | 109 | fpIn = fopen(argv[2], "r"); 110 | if (!fpIn) 111 | { 112 | printf("error : could not open p0io file \"%s\" for reading.\n", argv[2]); 113 | goto error; 114 | } 115 | 116 | nFileLength = _filelength(_fileno(fpIn)); 117 | if ((szEnd-szRoot) < nFileLength) 118 | { 119 | free(szRoot); 120 | szRoot = (char *)malloc(nFileLength+1); 121 | if (!szRoot) 122 | { 123 | printf("out of memory.\n"); 124 | goto error; 125 | } 126 | } 127 | 128 | fread(szRoot, nFileLength, 1, fpIn); 129 | szRoot[nFileLength] = '\0'; 130 | szTemp = szData = szRoot; 131 | szEnd = szData+nFileLength; 132 | 133 | szTemp = strstr(szTemp, "GetIdForString((pIdString_t) \""); 134 | while (szTemp != NULL) 135 | { 136 | char *szTemp2 = NULL; 137 | szData = szTemp; 138 | szData += sizeof("GetIdForString((pIdString_t) \"")-1; 139 | if (szData >= szEnd) 140 | { 141 | printf("error in (expected) format of p0io file.\n"); 142 | goto error; 143 | } 144 | szTemp2 = strchr(szData, '"'); 145 | if (!szTemp2) 146 | { 147 | printf("error in (expected) format of p0io file.\n"); 148 | goto error; 149 | } 150 | fprintf(fpOut, "%.*s,0\r\n", szTemp2-szData, szData); 151 | szTemp = strstr(szTemp+1, "GetIdForString((pIdString_t) \""); 152 | } 153 | 154 | goto end; 155 | 156 | error: 157 | 158 | nRet = 1; 159 | 160 | end: 161 | 162 | if (fpIn != NULL) 163 | { 164 | fclose(fpIn); 165 | } 166 | if (fpOut != NULL) 167 | { 168 | fclose(fpOut); 169 | } 170 | if (szRoot != NULL) 171 | { 172 | free(szRoot); 173 | } 174 | 175 | return nRet; 176 | } -------------------------------------------------------------------------------- /source/SProxy/utils/mkutils.cmd: -------------------------------------------------------------------------------- 1 | cl /GF /O1 /Os /Gy /Oi /Ob2 /Og /Oy /MD static_hash.c /link /NODEFAULTLIB /OPT:REF /OPT:ICF,32 msvcrt.lib kernel32.lib 2 | cl /GF /O1 /Os /Gy /Oi /Ob2 /Og /Oy /MD cppkw.c /link /NODEFAULTLIB /OPT:REF /OPT:ICF,32 msvcrt.lib kernel32.lib 3 | -------------------------------------------------------------------------------- /source/SProxy/xsdtypes.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabegundy/atlserver/e2f585fc7e073f7195564be86717e3faec79346e/source/SProxy/xsdtypes.in -------------------------------------------------------------------------------- /source/VCDeploy/depsettings.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | #pragma once 5 | 6 | #define INVALID_SETTING -1 7 | 8 | // CDepSettings holds all of our deployment settings 9 | class CDepSettings 10 | { 11 | public: 12 | CDepSettings(); 13 | unsigned int Load(LPCSTR szSettingsPath); 14 | HRESULT GetHostList(IXMLDOMNodeList **ppList); 15 | HRESULT GetAppMappingList(IXMLDOMNodeList **ppList); 16 | HRESULT GetFileGroups(IXMLDOMNodeList **ppList); 17 | LPCTSTR GetVirtDirName(){ return m_strVirtDirName; } 18 | LPCTSTR GetVirtDirFSPath(){ return m_strVirtDirFSPath; } 19 | LPCTSTR GetExtensionFileName(){ return m_strExtFileName; } 20 | bool GetRegIsapi(){ return m_bRegIsapi; } 21 | bool GetUnloadBeforeCopy(){ return m_bUnloadBeforeCopy; } 22 | bool SkipVirtDirCreation(){ return m_bDoNotCreateVirtDir; } 23 | int GetAppIsolation(){ return m_nAppIsolation == INVALID_SETTING ? 0 : m_nAppIsolation; } 24 | short GetIISMajorVer(); 25 | private: 26 | CComPtr m_spHostList; 27 | CComPtr m_spAppMappings; 28 | CComPtr m_spAppFileGroups; 29 | CString m_strVirtDirName; 30 | CString m_strVirtDirFSPath; 31 | CString m_strExtFileName; 32 | bool m_bRegIsapi; 33 | bool m_bDoNotCreateVirtDir; 34 | bool m_bUnloadBeforeCopy; 35 | short m_nAppIsolation; 36 | short m_nIISMajorVer; 37 | 38 | }; -------------------------------------------------------------------------------- /source/VCDeploy/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by atlsdply.rc 4 | // 5 | // Copyright (c) Microsoft Corporation. All rights reserved. 6 | // 7 | #define IDS_USAGE 101 8 | #define IDS_BANNER 102 9 | #define IDS_COMINIT_FAILED 103 10 | #define IDS_UPDATEIRL 104 11 | #define IDS_UNEXPECTED 106 12 | #define IDS_ERR_FAILEDTOCREATEDOM 107 13 | #define IDS_ERR_FAILEDTOLOAD_SETTINGS_XML 108 14 | #define IDS_ERR_BADROOTNODE 109 15 | #define IDS_ERR_WEBHOSTNAME 110 16 | #define IDS_ERR_NOVIRTDIR 111 17 | #define IDS_ERR_BADVIRTDIRNODE 112 18 | #define IDS_ERR_BADREGISTERISAPI 113 19 | #define IDS_ERR_INVALIDREGISTERISAPI 114 20 | #define IDS_ERR_BADUNLOADBEFORECOPY 115 21 | #define IDS_ERR_INVALIDUNLOADBEFORECOPY 116 22 | #define IDS_ERR_BADAPPISOLATION 117 23 | #define IDS_ERR_INVALIDAPPISOLATION 118 24 | #define IDS_ERR_NOVIRTDIRFSPATH 119 25 | #define IDS_ERR_BADVIRTDIRSFPATHNODE 120 26 | #define IDS_ERR_CONNECTADSFAILED 121 27 | #define IDS_ERR_CREATEVROOTFAILED 122 28 | #define IDS_ERR_SETADSPROPERTY 123 29 | #define IDS_FILEEXTATTR_NOTFOUND 124 30 | #define IDS_FILEEXTATTR_INVALID 125 31 | #define IDS_ERR_TOOMANYVERBS 126 32 | #define ATLS_ERR_TOOMANYVERBBLOCKS 127 33 | #define IDS_ERR_NOSTOPW3SVC 129 34 | #define IDS_ERR_W3SVCFAILEDTOSTART 130 35 | #define IDS_FAILEDOPENSCM 131 36 | #define IDS_FAILEDOPENSVC 132 37 | #define IDS_FAILEDSTOPCOMMAND 133 38 | #define IDS_FAILEDQUERYSTATUS 134 39 | #define IDS_FAILEDSTARTSVC 135 40 | #define IDS_ERR_CREATING_DIRECTORY 136 41 | #define IDS_ERR_CREATING_DIRECTORY_RELATIVE 137 42 | #define IDS_WARN_COPYING_FILE 138 43 | #define IDS_ERR_REGISTERING_EXTENSION 139 44 | #define IDS_ERR_REGISTERING_NOVDIRPATH 140 45 | #define IDS_ERR_REGISTERING_NOEXTFILE 141 46 | #define IDS_ERR_RUNTIME 142 47 | #define IDS_ERR_OUTOFMEM 143 48 | #define IDS_WARN_SOURCE_NOT_EXIST 144 49 | #define IDS_WARN_SOURCE_ACCESS_ERROR 145 50 | #define IDS_COPYFILE_MESSAGE 146 51 | #define IDS_FILES_IDENTICAL 147 52 | #define IDS_WARNING_FAILED_METABSESAVE 148 53 | #define IDS_WARNING_EMPTY_HOST_TAG 149 54 | #define IDS_MUSTBEADMIN 150 55 | #define IDS_CANTGETSECURITY 151 56 | #define IDS_ERR_BADDONOTCREATEVIRTDIR 152 57 | #define IDS_ERR_INVALIDDONOTCREATEVIRTDIR 153 58 | #define VER_LANGID_HEX 0409 59 | #define VER_LANGID 0x0409 60 | #define VER_CODEPAGE 0x04b0 61 | 62 | // Next default values for new objects 63 | // 64 | #ifdef APSTUDIO_INVOKED 65 | #ifndef APSTUDIO_READONLY_SYMBOLS 66 | #define _APS_NEXT_RESOURCE_VALUE 148 67 | #define _APS_NEXT_COMMAND_VALUE 40001 68 | #define _APS_NEXT_CONTROL_VALUE 1001 69 | #define _APS_NEXT_SYMED_VALUE 101 70 | #endif 71 | #endif 72 | -------------------------------------------------------------------------------- /source/VCDeploy/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // atlsdply.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | // 5 | // Copyright (c) Microsoft Corporation. All rights reserved. 6 | // 7 | 8 | #include "stdafx.h" 9 | 10 | // TODO: reference any additional headers you need in STDAFX.H 11 | // and not in this file 12 | -------------------------------------------------------------------------------- /source/VCDeploy/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | // Copyright (c) Microsoft Corporation. All rights reserved. 6 | // 7 | 8 | #pragma once 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | 12 | //Windows 2000 and higher 13 | #define _WIN32_WINNT 0x0500 14 | #define WINVER 0x0500 15 | 16 | #include 17 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit 18 | 19 | #include 20 | 21 | // for adsi objects 22 | #include 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | -------------------------------------------------------------------------------- /source/VCDeploy/vcdeploy.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 9.00 2 | # Visual Studio 2005 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vcdeploy", "vcdeploy.vcproj", "{87B2D818-3996-4BAD-AAE4-74F5F3B07438}" 4 | EndProject 5 | Global 6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 7 | Debug|Win32 = Debug|Win32 8 | Release|Win32 = Release|Win32 9 | EndGlobalSection 10 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 11 | {87B2D818-3996-4BAD-AAE4-74F5F3B07438}.Debug|Win32.ActiveCfg = Debug|Win32 12 | {87B2D818-3996-4BAD-AAE4-74F5F3B07438}.Debug|Win32.Build.0 = Debug|Win32 13 | {87B2D818-3996-4BAD-AAE4-74F5F3B07438}.Release|Win32.ActiveCfg = Release|Win32 14 | {87B2D818-3996-4BAD-AAE4-74F5F3B07438}.Release|Win32.Build.0 = Release|Win32 15 | EndGlobalSection 16 | GlobalSection(SolutionProperties) = preSolution 17 | HideSolutionNode = FALSE 18 | EndGlobalSection 19 | EndGlobal 20 | --------------------------------------------------------------------------------