Changeset 37930 for lang/c/AutoUpdater/trunk/AutoUpdater.c
- Timestamp:
- 07/14/10 22:44:27 (3 years ago)
- Files:
-
- 1 modified
-
lang/c/AutoUpdater/trunk/AutoUpdater.c (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/c/AutoUpdater/trunk/AutoUpdater.c
r37925 r37930 21 21 #define wcsdup(x) _wcsdup(x) 22 22 #endif 23 #endif 24 25 #ifdef __CYGWIN__ 26 27 # define _T(x) TEXT(x) 28 # define GUID_NULL AUI_GUID_NULL 29 # define IID_IDispatch AUI_IID_IDispatch 30 31 const GUID AUI_GUID_NULL = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0 }}; 32 const GUID AUI_IID_IDispatch = {0x00020400, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46}}; 33 34 # if defined(UNICODE) || defined(_UNICODE) 35 # include <wchar.h> 36 # define _tcslen wcslen 37 # define _tcsdup wcsdup 38 # define _tcscpy wcscpy 39 # define _tcscat wcscat 40 # define _tfopen(x, y) (NULL) 41 # define _vstprintf vswprintf 42 # else 43 # define _tcslen strlen 44 # define _tcsdup AUI_strdup 45 # define _tcscpy strcpy 46 # define _tcscat strcat 47 # define _tfopen fopen 48 # define _vstprintf vsprintf 49 # endif 50 51 #endif 52 53 #if ! __STDC_WANT_SECURE_LIB__ 54 #define _tfopen_s(x, y, z) {*x = _tfopen(y, z);} 55 #define _tcscpy_s(x, y, z) _tcscpy(x, z) 56 #define _tcscat_s(x, y, z) _tcscat(x, z) 23 57 #endif 24 58 … … 54 88 #if __STDC_WANT_SECURE_LIB__ 55 89 result = _vstprintf_s(buffer, count, format, ap); 90 #elif defined(UNICODE) || defined(_UNICODE) 91 result = vswprintf(buffer, count - 1, format, ap); 56 92 #else 57 93 if (count == 0) { … … 62 98 } 63 99 memset(buffer, 0, count * sizeof(TCHAR)); 64 #if __CYGWIN__ 65 result = _vstprintf(buffer, format, ap); 66 #else 67 result = _vsntprintf(buffer, count - 1, format, ap); 68 #endif 100 result = vsnprintf(buffer, format, ap); 69 101 #endif 70 102 va_end(ap); 71 103 return result; 72 104 } 73 74 75 #ifdef __CYGWIN__76 77 # define _T(x) TEXT(x)78 # define GUID_NULL AUI_GUID_NULL79 # define IID_IDispatch AUI_IID_IDispatch80 81 const GUID AUI_GUID_NULL = { 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 } };82 const GUID AUI_IID_IDispatch = { 0x00020400, 0, 0, { '\xc0', 0, 0, 0, 0, 0, 0, '\x46'} };83 84 # if defined(UNICODE) || defined(_UNICODE)85 # include <wchar.h>86 # define _tcslen wcslen87 # define _tcsdup wcsdup88 # define _tcscpy wcscpy89 # define _tcscat wcscat90 # define _tfopen fopen91 # define _vstprintf vswprintf92 # else93 # define _tcslen strlen94 # define _tcsdup AUI_strdup95 # define _tcscpy strcpy96 # define _tcscat strcat97 # define _tfopen fopen98 # define _vstprintf vsprintf99 # endif100 101 #endif102 103 #if ! __STDC_WANT_SECURE_LIB__104 #define _tfopen_s(x, y, z) {*x = _tfopen(y, z);}105 #define _tcscpy_s(x, y, z) _tcscpy(x, z)106 #define _tcscat_s(x, y, z) _tcscat(x, z)107 #endif108 109 105 110 106 typedef struct AUI_DownloadContext_ { … … 141 137 } AUI_Context; 142 138 143 const staticAU_Result AUI_SUCCESS = {1, 0, 0};144 const staticAU_Result AUI_IO_PENDING = {0, 1, 0};139 static const AU_Result AUI_SUCCESS = {1, 0, 0}; 140 static const AU_Result AUI_IO_PENDING = {0, 1, 0}; 145 141 146 142 static AU_Result E(AU_Error error) { … … 698 694 IDispatch* descriptionNode = NULL; 699 695 700 // --------------------------------------------------------------701 // CoInitialize702 // --------------------------------------------------------------703 696 { 704 697 result = CoInitialize(NULL); … … 708 701 break; 709 702 case S_FALSE: 710 / / CoInitialize: The COM library is already initialized on this thread703 /* CoInitialize: The COM library is already initialized on this thread */ 711 704 break; 712 705 case RPC_E_CHANGED_MODE: 713 // CoInitialize: A previous call to CoInitializeEx specified the concurrency model for this thread as multithread apartment (MTA). If running Windows 2000, this could also mean that a change from neutral-threaded apartment to single-threaded apartment occurred. 714 break; 715 } 716 } 717 718 // -------------------------------------------------------------- 719 // var Microsoft_XMLDOM = new ActiveXObject("Microsoft.XMLDOM") 720 // -------------------------------------------------------------- 706 /* CoInitialize: A previous call to CoInitializeEx specified the concurrency model for this thread as multithread apartment (MTA). If running Windows 2000, this could also mean that a change from neutral-threaded apartment to single-threaded apartment occurred. */ 707 break; 708 } 709 } 710 711 /* var Microsoft_XMLDOM = new ActiveXObject("Microsoft.XMLDOM") */ 721 712 { 722 713 OLECHAR clsid_str[] = OLESTR("Microsoft.XMLDOM"); … … 728 719 { 729 720 case NOERROR: 730 / /The CLSID was obtained successfully.721 /* The CLSID was obtained successfully. */ 731 722 break; 732 723 case E_INVALIDARG: … … 734 725 break; 735 726 case CO_E_CLASSSTRING: 736 / /The class string was improperly formatted.727 /* The class string was improperly formatted. */ 737 728 return; 738 729 break; 739 730 case REGDB_E_CLASSNOTREG: 740 / /The CLSID corresponding to the class string was not found in the registry.731 /* The CLSID corresponding to the class string was not found in the registry. */ 741 732 return; 742 733 break; 743 734 case REGDB_E_READREGDB: 744 / /The registry could not be opened for reading.735 /* The registry could not be opened for reading. */ 745 736 return; 746 737 break; 747 738 default: 748 //749 739 return; 750 740 break; … … 762 752 break; 763 753 case REGDB_E_CLASSNOTREG: 764 //Debug("");765 754 return; 766 755 break; 767 756 case CLASS_E_NOAGGREGATION: 768 / /Debug("This class cannot be created as part of an aggregate");757 /* This class cannot be created as part of an aggregate */ 769 758 return; 770 759 break; 771 760 case E_NOINTERFACE: 772 / /Debug("The specified class does not implement the requested interface, or the controlling IUnknown does not expose the requested interface");761 /* The specified class does not implement the requested interface, or the controlling IUnknown does not expose the requested interface */ 773 762 return; 774 763 break; 775 764 default: 776 / /Debug("CoCreateInstance unknown error: " << result);765 /* unknown error: */ 777 766 return; 778 767 break; … … 781 770 if (Microsoft_XMLDOM == NULL) 782 771 { 783 //Debug("pDispatch is NULL"); 784 } 785 } 786 // -------------------------------------------------------------- 787 // Microsoft_XMLDOM.async = false 788 // -------------------------------------------------------------- 789 { 772 return; 773 } 774 } 775 776 777 { /* Microsoft_XMLDOM.async = false */ 790 778 args[0].vt = VT_BOOL; 791 779 args[0].boolVal = VARIANT_FALSE; … … 793 781 } 794 782 795 // -------------------------------------------------------------- 796 // Microsoft_XMLDOM.load("file.xml") 797 // -------------------------------------------------------------- 798 { 783 784 { /* Microsoft_XMLDOM.load("file.xml") */ 799 785 args[0].vt = VT_BSTR; 800 / /args[0].bstrVal = SysAllocString(OLESTR("c:/Documents and Settings/saturday06/My Documents/My Dropbox/jsxml.xml"));786 /* args[0].bstrVal = SysAllocString(OLESTR("c:/Documents and Settings/saturday06/My Documents/My Dropbox/jsxml.xml")); */ 801 787 args[0].bstrVal = SysAllocString(OLESTR("D:/Documents/My Dropbox/jsxml.xml")); 802 788 result = AUI_AutoWrap(DISPATCH_METHOD, &returnValue, Microsoft_XMLDOM, OLESTR("load"), 1, args); … … 810 796 } 811 797 812 // -------------------------------------------------------------- 813 // Microsoft_XMLDOM.setProperty("SelectionLanguage", "XPath"); 814 // -------------------------------------------------------------- 815 { 798 { /* Microsoft_XMLDOM.setProperty("SelectionLanguage", "XPath"); */ 816 799 args[0].vt = VT_BSTR; 817 800 args[0].bstrVal = SysAllocString(OLESTR("SelectionLanguage")); … … 829 812 } 830 813 } 831 832 // -------------------------------------------------------------- 833 // var documentElement = Microsoft_XMLDOM.documentElement 834 // -------------------------------------------------------------- 835 { 814 815 { /* var documentElement = Microsoft_XMLDOM.documentElement */ 836 816 result = AUI_AutoWrap(DISPATCH_PROPERTYGET, &returnValue, Microsoft_XMLDOM, OLESTR("documentElement"), 0, NULL); 837 817 if (FAILED(result)) { … … 845 825 } 846 826 847 // -------------------------------------------------------------- 848 // var releaseNode = documentElement.selectSingleNode("..."); 849 // -------------------------------------------------------------- 850 { 827 { /* var releaseNode = documentElement.selectSingleNode("..."); */ 851 828 #define DEBUG_CONDITION OLESTR("not(@debug) or @debug < 1") 852 829 OLECHAR cond[] = … … 872 849 VariantClear(&returnValue); 873 850 } 874 875 // -------------------------------------------------------------- 876 // var urlNode = releaseNode.selectSingleNode("url"); 877 // -------------------------------------------------------------- 878 { 851 852 { /* var urlNode = releaseNode.selectSingleNode("url"); */ 879 853 args[0].vt = VT_BSTR; 880 854 args[0].bstrVal = SysAllocString(OLESTR("url")); … … 894 868 } 895 869 896 // -------------------------------------------------------------- 897 // urlNode.text; 898 // -------------------------------------------------------------- 899 { 870 { /* urlNode.text; */ 900 871 result = AUI_AutoWrap(DISPATCH_PROPERTYGET, &returnValue, urlNode, OLESTR("text"), 0, NULL); 901 872 if (FAILED(result)) {
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)