diff --git a/.gitignore b/.gitignore index c5079f74926c7f7d936dffc8e90886c1fd9150d9..71329ce4487f51cb6a6272fccbdc8bfb9badb987 100644 --- a/.gitignore +++ b/.gitignore @@ -59,6 +59,7 @@ # VC project *.user .vs +*.filters @@ -99,3 +100,4 @@ CTestTestfile.cmake #lbyc file main + diff --git a/adapterjs/CMakeLists.txt b/adapterjs/CMakeLists.txt deleted file mode 100644 index a360412fbd70c58b024f450fe4e78015ecace5a9..0000000000000000000000000000000000000000 --- a/adapterjs/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -set(adapterjs_src dllmain.cpp - adapterjavascriptimpl.cpp) - - -include_directories(${PROJECT_SOURCE_DIR}/include) -include_directories(${PROJECT_SOURCE_DIR}/extensions/include) -include_directories(${by3rd_library_include}) -include_directories(/usr/local/include/) -include_directories(/usr/local/node/include/) - -link_directories(/usr/local/lib) - - -set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) -add_library(adapterjs SHARED ${adapterjs_src}) -set_target_properties(adapterjs PROPERTIES OUTPUT_NAME "adapterjs") -set_target_properties(adapterjs PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -std=c++11 -fpermissive -fPIC -frtti -fexceptions") - -if(CMAKE_BUILD_TYPE STREQUAL Debug) - set_target_properties(adapterjs PROPERTIES COMPILE_FLAGS "-g3") -endif() - -if(CMAKE_BUILD_TYPE STREQUAL Release) - set_target_properties(adapterjs PROPERTIES COMPILE_FLAGS "-O3") -endif() - -target_link_libraries(adapterjs dl pthread) - -install(TARGETS adapterjs - LIBRARY DESTINATION bin - ARCHIVE DESTINATION bin) diff --git a/adapterjs/ReadMe.txt b/adapterjs/ReadMe.txt deleted file mode 100644 index 902220d6f01da3309339d7ae9c955f9b811fc051..0000000000000000000000000000000000000000 --- a/adapterjs/ReadMe.txt +++ /dev/null @@ -1,41 +0,0 @@ -======================================================================== - DYNAMIC LINK LIBRARY : Plugin Project Overview -======================================================================== - -AppWizard has created this Plugin DLL for you. - -This file contains a summary of what you will find in each of the files that -make up your Plugin application. - - -Plugin.vcproj - This is the main project file for VC++ projects generated using an Application Wizard. - It contains information about the version of Visual C++ that generated the file, and - information about the platforms, configurations, and project features selected with the - Application Wizard. - -Plugin.cpp - This is the main DLL source file. - - When created, this DLL does not export any symbols. As a result, it - will not produce a .lib file when it is built. If you wish this project - to be a project dependency of some other project, you will either need to - add code to export some symbols from the DLL so that an export library - will be produced, or you can set the Ignore Input Library property to Yes - on the General propert page of the Linker folder in the project's Property - Pages dialog box. - -///////////////////////////////////////////////////////////////////////////// -Other standard files: - -StdAfx.h, StdAfx.cpp - These files are used to build a precompiled header (PCH) file - named Plugin.pch and a precompiled types file named StdAfx.obj. - -///////////////////////////////////////////////////////////////////////////// -Other notes: - -AppWizard uses "TODO:" comments to indicate parts of the source code you -should add to or customize. - -///////////////////////////////////////////////////////////////////////////// diff --git a/adapterjs/adapterjs.vcxproj b/adapterjs/adapterjs.vcxproj deleted file mode 100644 index 6054ad485238abe2b544565d225feabc4f5a573a..0000000000000000000000000000000000000000 --- a/adapterjs/adapterjs.vcxproj +++ /dev/null @@ -1,137 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {DDCA9970-5DE8-4318-935B-6781CDF01583} - Plugin - Win32Proj - 10.0.16299.0 - - - - DynamicLibrary - v141 - Unicode - true - - - DynamicLibrary - v141 - Unicode - - - - - - - - - - - - - <_ProjectFileVersion>14.0.25123.0 - - - $(SolutionDir)\bin\$(IntDir) - $(Configuration)\ - true - MinimumRecommendedRules.ruleset - - - - - $(SolutionDir)\bin\$(IntDir) - $(Configuration)\ - false - MinimumRecommendedRules.ruleset - - - - - - Disabled - ../include;../extensions/include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGIN_EXPORTS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - NotUsing - Level3 - EditAndContinue - - - $(OutDir)\$(ProjectName).dll - ..\lib;%(AdditionalLibraryDirectories) - dllexports.def - true - ..\obj\$(IntDir)$(TargetName).pdb - Windows - ..\lib\$(IntDir)$(TargetName).lib - MachineX86 - - - - - MaxSpeed - true - ../include;../extensions/include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - true - NotUsing - Level3 - ProgramDatabase - - - $(OutDir)\$(ProjectName).dll - ..\lib;%(AdditionalLibraryDirectories) - dllexports.def - true - ..\obj\$(IntDir)$(TargetName).pdb - Windows - true - true - ..\lib\$(IntDir)$(TargetName).lib - MachineX86 - - - - - - - - - - - false - - - false - - - Create - Create - - - - - - - - - - - - - - \ No newline at end of file diff --git a/adapterjs/dllexports.def b/adapterjs/dllexports.def deleted file mode 100644 index e0a4276e2262900ca133a8f025a08a1aa28d91e9..0000000000000000000000000000000000000000 --- a/adapterjs/dllexports.def +++ /dev/null @@ -1,5 +0,0 @@ -EXPORTS - DllCanUnloadNow PRIVATE - DllGetClassObject PRIVATE - DllRegisterServer PRIVATE - DllUnregisterServer PRIVATE \ No newline at end of file diff --git a/adapterjs/dllmain.cpp b/adapterjs/dllmain.cpp deleted file mode 100644 index 46d38fb668d61adfe16188f6350e6e8ea7f4d038..0000000000000000000000000000000000000000 --- a/adapterjs/dllmain.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// dllmain.cpp : Defines the entry point for the DLL application. -#include "stdafx.h" -#include "adapterjavascriptimpl.h" - -BOOL APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} - - -BEGIN_CLIDMAP - CLIDMAPENTRY_BEGIN - CLIDMAPENTRY_PROGID(CLSID_AdapaterJavaScript, CAdapterjavascriptImpl,"Adapterjavascript.Impl") - CLIDMAPENTRY_END -END_CLIDMAP_AND_EXPORTFUN -MD_EXPORTS DllCanUnloadNow(void) -{ - return FALSE; -} - -MD_EXPORTS DllRegisterServer(void) -{ - return S_OK; -} -MD_EXPORTS DllUnregisterServer(void) -{ - return S_OK; -} \ No newline at end of file diff --git a/adapterjs/stdafx.cpp b/adapterjs/stdafx.cpp deleted file mode 100644 index 6df3550ce81cc351d786ce90d7c996762fce08ab..0000000000000000000000000000000000000000 --- a/adapterjs/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// Plugin.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/adapterjs/stdafx.h b/adapterjs/stdafx.h deleted file mode 100644 index 0f2c0d7f86b6e301819d097dff60d953c4c755cc..0000000000000000000000000000000000000000 --- a/adapterjs/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#ifndef _STDAFX_H_ -#define _STDAFX_H_ - -#include - -#include -#include -#include -#include -using namespace by; - -#include -#include - -#endif \ No newline at end of file diff --git a/adapterjs/targetver.h b/adapterjs/targetver.h deleted file mode 100644 index 203dfbcf61107432f6b42793715d96f7b06d5802..0000000000000000000000000000000000000000 --- a/adapterjs/targetver.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -// The following macros define the minimum required platform. The minimum required platform -// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run -// your application. The macros work by enabling all features available on platform versions up to and -// including the version specified. - -// Modify the following defines if you have to target a platform prior to the ones specified below. -// Refer to MSDN for the latest info on corresponding values for different platforms. -#ifndef WINVER // Specifies that the minimum required platform is Windows Vista. -#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. -#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98. -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. -#endif - -#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0. -#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE. -#endif diff --git a/adapterlua/CMakeLists.txt b/adapterlua/CMakeLists.txt deleted file mode 100644 index 4dedb403604bca1682199285f0d66586e6dc6727..0000000000000000000000000000000000000000 --- a/adapterlua/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -set(adapterlua_src dllmain.cpp - adapterluaimpl.cpp) - -if (${UNIX_OS}) - include_directories( - ${PROJECT_SOURCE_DIR}/include - ${PROJECT_SOURCE_DIR}//extensions/include - ${by3rd_library_include} - /usr/local/include - /opt/local/include - /usr/include - ) -elseif (${WIN_OS}) - -else() - -endif() - - -set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) -add_library(adapterlua SHARED ${adapterlua_src}) -set_target_properties(adapterlua PROPERTIES OUTPUT_NAME "adapterlua") -set_target_properties(adapterlua PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -std=c++11 -fpermissive -fPIC -frtti -fexceptions") - - -if(CMAKE_BUILD_TYPE STREQUAL Debug) - set_target_properties(adapterlua PROPERTIES COMPILE_FLAGS "-g3") -endif() - -if(CMAKE_BUILD_TYPE STREQUAL Release) - set_target_properties(adapterlua PROPERTIES COMPILE_FLAGS "-O3") -endif() - - - -target_link_libraries(adapterlua dl crypt m lua5.1) - -install(TARGETS adapterlua - LIBRARY DESTINATION bin - ARCHIVE DESTINATION bin) diff --git a/adapterlua/ReadMe.txt b/adapterlua/ReadMe.txt deleted file mode 100644 index 902220d6f01da3309339d7ae9c955f9b811fc051..0000000000000000000000000000000000000000 --- a/adapterlua/ReadMe.txt +++ /dev/null @@ -1,41 +0,0 @@ -======================================================================== - DYNAMIC LINK LIBRARY : Plugin Project Overview -======================================================================== - -AppWizard has created this Plugin DLL for you. - -This file contains a summary of what you will find in each of the files that -make up your Plugin application. - - -Plugin.vcproj - This is the main project file for VC++ projects generated using an Application Wizard. - It contains information about the version of Visual C++ that generated the file, and - information about the platforms, configurations, and project features selected with the - Application Wizard. - -Plugin.cpp - This is the main DLL source file. - - When created, this DLL does not export any symbols. As a result, it - will not produce a .lib file when it is built. If you wish this project - to be a project dependency of some other project, you will either need to - add code to export some symbols from the DLL so that an export library - will be produced, or you can set the Ignore Input Library property to Yes - on the General propert page of the Linker folder in the project's Property - Pages dialog box. - -///////////////////////////////////////////////////////////////////////////// -Other standard files: - -StdAfx.h, StdAfx.cpp - These files are used to build a precompiled header (PCH) file - named Plugin.pch and a precompiled types file named StdAfx.obj. - -///////////////////////////////////////////////////////////////////////////// -Other notes: - -AppWizard uses "TODO:" comments to indicate parts of the source code you -should add to or customize. - -///////////////////////////////////////////////////////////////////////////// diff --git a/adapterlua/adapterlua.vcxproj b/adapterlua/adapterlua.vcxproj deleted file mode 100644 index f808d1ad1ed05fdd0c086c7f86f538dc093b6ffa..0000000000000000000000000000000000000000 --- a/adapterlua/adapterlua.vcxproj +++ /dev/null @@ -1,137 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {AB4B3FFB-7301-40AE-BF1E-14C50A40DB13} - Plugin - Win32Proj - 10.0.16299.0 - - - - DynamicLibrary - v141 - Unicode - true - - - DynamicLibrary - v141 - Unicode - - - - - - - - - - - - - <_ProjectFileVersion>14.0.25123.0 - - - $(SolutionDir)\bin\$(IntDir) - $(Configuration)\ - true - MinimumRecommendedRules.ruleset - - - - - $(SolutionDir)\bin\$(IntDir) - $(Configuration)\ - false - MinimumRecommendedRules.ruleset - - - - - - Disabled - ../include;../extensions/include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGIN_EXPORTS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - NotUsing - Level3 - EditAndContinue - - - $(OutDir)\$(ProjectName).dll - ..\lib;%(AdditionalLibraryDirectories) - dllexports.def - true - ..\obj\$(IntDir)$(TargetName).pdb - Windows - ..\lib\$(IntDir)$(TargetName).lib - MachineX86 - - - - - MaxSpeed - true - ../include;../extensions/include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - true - NotUsing - Level3 - ProgramDatabase - - - $(OutDir)\$(ProjectName).dll - ..\lib;%(AdditionalLibraryDirectories) - dllexports.def - true - ..\obj\$(IntDir)$(TargetName).pdb - Windows - true - true - ..\lib\$(IntDir)$(TargetName).lib - MachineX86 - - - - - - - - - - - false - - - false - - - Create - Create - - - - - - - - - - - - - - \ No newline at end of file diff --git a/adapterlua/dllexports.def b/adapterlua/dllexports.def deleted file mode 100644 index e0a4276e2262900ca133a8f025a08a1aa28d91e9..0000000000000000000000000000000000000000 --- a/adapterlua/dllexports.def +++ /dev/null @@ -1,5 +0,0 @@ -EXPORTS - DllCanUnloadNow PRIVATE - DllGetClassObject PRIVATE - DllRegisterServer PRIVATE - DllUnregisterServer PRIVATE \ No newline at end of file diff --git a/adapterlua/dllmain.cpp b/adapterlua/dllmain.cpp deleted file mode 100644 index 3f3f93f2cdaf2f57b340151c816e5618124ef09a..0000000000000000000000000000000000000000 --- a/adapterlua/dllmain.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// dllmain.cpp : Defines the entry point for the DLL application. -#include "stdafx.h" -#include "adapterluaimpl.h" - -BOOL APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} - - -BEGIN_CLIDMAP - CLIDMAPENTRY_BEGIN - CLIDMAPENTRY_PROGID(CLSID_AdapaterLua, CAdapterluaImpl,"Adapterlua.Impl") - CLIDMAPENTRY_END -END_CLIDMAP_AND_EXPORTFUN -MD_EXPORTS DllCanUnloadNow(void) -{ - return FALSE; -} - -MD_EXPORTS DllRegisterServer(void) -{ - return S_OK; -} -MD_EXPORTS DllUnregisterServer(void) -{ - return S_OK; -} \ No newline at end of file diff --git a/adapterlua/stdafx.cpp b/adapterlua/stdafx.cpp deleted file mode 100644 index 6df3550ce81cc351d786ce90d7c996762fce08ab..0000000000000000000000000000000000000000 --- a/adapterlua/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// Plugin.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/adapterlua/stdafx.h b/adapterlua/stdafx.h deleted file mode 100644 index 0f2c0d7f86b6e301819d097dff60d953c4c755cc..0000000000000000000000000000000000000000 --- a/adapterlua/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#ifndef _STDAFX_H_ -#define _STDAFX_H_ - -#include - -#include -#include -#include -#include -using namespace by; - -#include -#include - -#endif \ No newline at end of file diff --git a/adapterlua/targetver.h b/adapterlua/targetver.h deleted file mode 100644 index 203dfbcf61107432f6b42793715d96f7b06d5802..0000000000000000000000000000000000000000 --- a/adapterlua/targetver.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -// The following macros define the minimum required platform. The minimum required platform -// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run -// your application. The macros work by enabling all features available on platform versions up to and -// including the version specified. - -// Modify the following defines if you have to target a platform prior to the ones specified below. -// Refer to MSDN for the latest info on corresponding values for different platforms. -#ifndef WINVER // Specifies that the minimum required platform is Windows Vista. -#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. -#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98. -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. -#endif - -#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0. -#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE. -#endif diff --git a/adapterpy/CMakeLists.txt b/adapterpy/CMakeLists.txt deleted file mode 100644 index da5dfd3c5f717dbd4aa214fc6fd32378dbc07609..0000000000000000000000000000000000000000 --- a/adapterpy/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -set(adapterpy_src dllmain.cpp - adapterpyimpl.cpp) - -if (${UNIX_OS}) - include_directories( - ${PROJECT_SOURCE_DIR}/include - ${PROJECT_SOURCE_DIR}//extensions/include - ${by3rd_library_include} - /usr/local/include - /opt/local/include - /usr/include - /usr/include/python3.4m - ) -elseif (${WIN_OS}) - -else() - -endif() - - -set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) -add_library(adapterpy SHARED ${adapterpy_src}) -set_target_properties(adapterpy PROPERTIES OUTPUT_NAME "adapterpy") -set_target_properties(adapterpy PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -std=c++11 -fpermissive -fPIC -frtti -fexceptions") - -if(CMAKE_BUILD_TYPE STREQUAL Debug) - set_target_properties(adapterpy PROPERTIES COMPILE_FLAGS "-g3") -endif() - -if(CMAKE_BUILD_TYPE STREQUAL Release) - set_target_properties(adapterpy PROPERTIES COMPILE_FLAGS "-O3") -endif() - - -link_directories(/usr/lib/x86_64-linux-gnu) - -target_link_libraries(adapterpy dl crypt m libpython3.4m.so) - -install(TARGETS adapterpy - LIBRARY DESTINATION bin - ARCHIVE DESTINATION bin) diff --git a/adapterpy/ReadMe.txt b/adapterpy/ReadMe.txt deleted file mode 100644 index f78276230b17671727dbb89ccc594b269eeec12c..0000000000000000000000000000000000000000 --- a/adapterpy/ReadMe.txt +++ /dev/null @@ -1,147 +0,0 @@ -Importer des modules¶ -PyObject* PyImport_ImportModule(const char *name) -Return value: New reference. -This is a simplified interface to PyImport_ImportModuleEx() below, leaving the globals and locals arguments set to NULL and level set to 0. When the name argument contains a dot (when it specifies a submodule of a package), the fromlist argument is set to the list ['*'] so that the return value is the named module rather than the top-level package containing it as would otherwise be the case. (Unfortunately, this has an additional side effect when name in fact specifies a subpackage instead of a submodule: the submodules specified in the package’s __all__ variable are loaded.) Return a new reference to the imported module, or NULL with an exception set on failure. A failing import of a module doesn’t leave the module in sys.modules. - -This function always uses absolute imports. - -PyObject* PyImport_ImportModuleNoBlock(const char *name) -This function is a deprecated alias of PyImport_ImportModule(). - -Modifié dans la version 3.3: This function used to fail immediately when the import lock was held by another thread. In Python 3.3 though, the locking scheme switched to per-module locks for most purposes, so this function’s special behaviour isn’t needed anymore. - -PyObject* PyImport_ImportModuleEx(const char *name, PyObject *globals, PyObject *locals, PyObject *fromlist) -Return value: New reference. -Import a module. This is best described by referring to the built-in Python function __import__(). - -The return value is a new reference to the imported module or top-level package, or NULL with an exception set on failure. Like for __import__(), the return value when a submodule of a package was requested is normally the top-level package, unless a non-empty fromlist was given. - -Failing imports remove incomplete module objects, like with PyImport_ImportModule(). - -PyObject* PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level) -Import a module. This is best described by referring to the built-in Python function __import__(), as the standard __import__() function calls this function directly. - -The return value is a new reference to the imported module or top-level package, or NULL with an exception set on failure. Like for __import__(), the return value when a submodule of a package was requested is normally the top-level package, unless a non-empty fromlist was given. - -Nouveau dans la version 3.3. - -PyObject* PyImport_ImportModuleLevel(const char *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level) -Return value: New reference. -Similar to PyImport_ImportModuleLevelObject(), but the name is a UTF-8 encoded string instead of a Unicode object. - -Modifié dans la version 3.3: Negative values for level are no longer accepted. - -PyObject* PyImport_Import(PyObject *name) -Return value: New reference. -This is a higher-level interface that calls the current « import hook function » (with an explicit level of 0, meaning absolute import). It invokes the __import__() function from the __builtins__ of the current globals. This means that the import is done using whatever import hooks are installed in the current environment. - -This function always uses absolute imports. - -PyObject* PyImport_ReloadModule(PyObject *m) -Return value: New reference. -Reload a module. Return a new reference to the reloaded module, or NULL with an exception set on failure (the module still exists in this case). - -PyObject* PyImport_AddModuleObject(PyObject *name) -Return the module object corresponding to a module name. The name argument may be of the form package.module. First check the modules dictionary if there’s one there, and if not, create a new one and insert it in the modules dictionary. Return NULL with an exception set on failure. - -Note This function does not load or import the module; if the module wasn’t already loaded, you will get an empty module object. Use PyImport_ImportModule() or one of its variants to import a module. Package structures implied by a dotted name for name are not created if not already present. -Nouveau dans la version 3.3. - -PyObject* PyImport_AddModule(const char *name) -Return value: Borrowed reference. -Similar to PyImport_AddModuleObject(), but the name is a UTF-8 encoded string instead of a Unicode object. - -PyObject* PyImport_ExecCodeModule(const char *name, PyObject *co) -Return value: New reference. -Given a module name (possibly of the form package.module) and a code object read from a Python bytecode file or obtained from the built-in function compile(), load the module. Return a new reference to the module object, or NULL with an exception set if an error occurred. name is removed from sys.modules in error cases, even if name was already in sys.modules on entry to PyImport_ExecCodeModule(). Leaving incompletely initialized modules in sys.modules is dangerous, as imports of such modules have no way to know that the module object is an unknown (and probably damaged with respect to the module author’s intents) state. - -The module’s __spec__ and __loader__ will be set, if not set already, with the appropriate values. The spec’s loader will be set to the module’s __loader__ (if set) and to an instance of SourceFileLoader otherwise. - -The module’s __file__ attribute will be set to the code object’s co_filename. If applicable, __cached__ will also be set. - -This function will reload the module if it was already imported. See PyImport_ReloadModule() for the intended way to reload a module. - -If name points to a dotted name of the form package.module, any package structures not already created will still not be created. - -See also PyImport_ExecCodeModuleEx() and PyImport_ExecCodeModuleWithPathnames(). - -PyObject* PyImport_ExecCodeModuleEx(const char *name, PyObject *co, const char *pathname) -Return value: New reference. -Like PyImport_ExecCodeModule(), but the __file__ attribute of the module object is set to pathname if it is non-NULL. - -See also PyImport_ExecCodeModuleWithPathnames(). - -PyObject* PyImport_ExecCodeModuleObject(PyObject *name, PyObject *co, PyObject *pathname, PyObject *cpathname) -Like PyImport_ExecCodeModuleEx(), but the __cached__ attribute of the module object is set to cpathname if it is non-NULL. Of the three functions, this is the preferred one to use. - -Nouveau dans la version 3.3. - -PyObject* PyImport_ExecCodeModuleWithPathnames(const char *name, PyObject *co, const char *pathname, const char *cpathname) -Like PyImport_ExecCodeModuleObject(), but name, pathname and cpathname are UTF-8 encoded strings. Attempts are also made to figure out what the value for pathname should be from cpathname if the former is set to NULL. - -Nouveau dans la version 3.2. - -Modifié dans la version 3.3: Uses imp.source_from_cache() in calculating the source path if only the bytecode path is provided. - -long PyImport_GetMagicNumber() -Return the magic number for Python bytecode files (a.k.a. .pyc file). The magic number should be present in the first four bytes of the bytecode file, in little-endian byte order. Returns -1 on error. - -Modifié dans la version 3.3: Return value of -1 upon failure. - -const char * PyImport_GetMagicTag() -Return the magic tag string for PEP 3147 format Python bytecode file names. Keep in mind that the value at sys.implementation.cache_tag is authoritative and should be used instead of this function. - -Nouveau dans la version 3.2. - -PyObject* PyImport_GetModuleDict() -Return value: Borrowed reference. -Return the dictionary used for the module administration (a.k.a. sys.modules). Note that this is a per-interpreter variable. - -PyObject* PyImport_GetImporter(PyObject *path) -Return a finder object for a sys.path/pkg.__path__ item path, possibly by fetching it from the sys.path_importer_cache dict. If it wasn’t yet cached, traverse sys.path_hooks until a hook is found that can handle the path item. Return None if no hook could; this tells our caller that the path based finder could not find a finder for this path item. Cache the result in sys.path_importer_cache. Return a new reference to the finder object. - -void _PyImport_Init() -Initialize the import mechanism. For internal use only. - -void PyImport_Cleanup() -Empty the module table. For internal use only. - -void _PyImport_Fini() -Finalize the import mechanism. For internal use only. - -PyObject* _PyImport_FindExtension(char *, char *) -For internal use only. - -int PyImport_ImportFrozenModuleObject(PyObject *name) -Load a frozen module named name. Return 1 for success, 0 if the module is not found, and -1 with an exception set if the initialization failed. To access the imported module on a successful load, use PyImport_ImportModule(). (Note the misnomer — this function would reload the module if it was already imported.) - -Nouveau dans la version 3.3. - -Modifié dans la version 3.4: The __file__ attribute is no longer set on the module. - -int PyImport_ImportFrozenModule(const char *name) -Similar to PyImport_ImportFrozenModuleObject(), but the name is a UTF-8 encoded string instead of a Unicode object. - -struct _frozen -This is the structure type definition for frozen module descriptors, as generated by the freeze utility (see Tools/freeze/ in the Python source distribution). Its definition, found in Include/import.h, is: - -struct _frozen { - char *name; - unsigned char *code; - int size; -}; -const struct _frozen* PyImport_FrozenModules -This pointer is initialized to point to an array of struct _frozen records, terminated by one whose members are all NULL or zero. When a frozen module is imported, it is searched in this table. Third-party code could play tricks with this to provide a dynamically created collection of frozen modules. - -int PyImport_AppendInittab(const char *name, PyObject* (*initfunc)(void)) -Add a single module to the existing table of built-in modules. This is a convenience wrapper around PyImport_ExtendInittab(), returning -1 if the table could not be extended. The new module can be imported by the name name, and uses the function initfunc as the initialization function called on the first attempted import. This should be called before Py_Initialize(). - -struct _inittab -Structure describing a single entry in the list of built-in modules. Each of these structures gives the name and initialization function for a module built into the interpreter. The name is an ASCII encoded string. Programs which embed Python may use an array of these structures in conjunction with PyImport_ExtendInittab() to provide additional built-in modules. The structure is defined in Include/import.h as: - -struct _inittab { - char *name; /* ASCII encoded string */ - PyObject* (*initfunc)(void); -}; -int PyImport_ExtendInittab(struct _inittab *newtab) -Add a collection of modules to the table of built-in modules. The newtab array must end with a sentinel entry which contains NULL for the name field; failure to provide the sentinel value can result in a memory fault. Returns 0 on success or -1 if insufficient memory could be allocated to extend the internal table. In the event of failure, no modules are added to the internal table. This should be called before Py_Initialize(). \ No newline at end of file diff --git a/adapterpy/adapterpy.vcxproj b/adapterpy/adapterpy.vcxproj deleted file mode 100644 index 1f3a9f929685dfa6f868942a6194a14f9f609f69..0000000000000000000000000000000000000000 --- a/adapterpy/adapterpy.vcxproj +++ /dev/null @@ -1,137 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {97F6418A-F7A8-4C57-8D0F-93C8E9BDA4A2} - Plugin - Win32Proj - 10.0.16299.0 - - - - DynamicLibrary - v141 - Unicode - true - - - DynamicLibrary - v141 - Unicode - - - - - - - - - - - - - <_ProjectFileVersion>14.0.25123.0 - - - $(SolutionDir)\bin\$(IntDir) - $(Configuration)\ - true - MinimumRecommendedRules.ruleset - - - - - $(SolutionDir)\bin\$(IntDir) - $(Configuration)\ - false - MinimumRecommendedRules.ruleset - - - - - - Disabled - ../include;../extensions/include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;PLUGIN_EXPORTS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - NotUsing - Level3 - EditAndContinue - - - $(OutDir)\$(ProjectName).dll - ..\lib;%(AdditionalLibraryDirectories) - dllexports.def - true - ..\obj\$(IntDir)$(TargetName).pdb - Windows - ..\lib\$(IntDir)$(TargetName).lib - MachineX86 - - - - - MaxSpeed - true - ../include;../extensions/include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - true - NotUsing - Level3 - ProgramDatabase - - - $(OutDir)\$(ProjectName).dll - ..\lib;%(AdditionalLibraryDirectories) - dllexports.def - true - ..\obj\$(IntDir)$(TargetName).pdb - Windows - true - true - ..\lib\$(IntDir)$(TargetName).lib - MachineX86 - - - - - - - - - - - false - - - false - - - Create - Create - - - - - - - - - - - - - - \ No newline at end of file diff --git a/adapterpy/dllexports.def b/adapterpy/dllexports.def deleted file mode 100644 index e0a4276e2262900ca133a8f025a08a1aa28d91e9..0000000000000000000000000000000000000000 --- a/adapterpy/dllexports.def +++ /dev/null @@ -1,5 +0,0 @@ -EXPORTS - DllCanUnloadNow PRIVATE - DllGetClassObject PRIVATE - DllRegisterServer PRIVATE - DllUnregisterServer PRIVATE \ No newline at end of file diff --git a/adapterpy/dllmain.cpp b/adapterpy/dllmain.cpp deleted file mode 100644 index 09ef47f09680f4643a0af4c91c977abae0057d29..0000000000000000000000000000000000000000 --- a/adapterpy/dllmain.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// dllmain.cpp : Defines the entry point for the DLL application. -#include "stdafx.h" -#include "adapterpyimpl.h" - -BOOL APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} - - -BEGIN_CLIDMAP - CLIDMAPENTRY_BEGIN - CLIDMAPENTRY_PROGID(CLSID_AdapterPy, CAdapterpyImpl,"Adapterpy.Impl") - CLIDMAPENTRY_END -END_CLIDMAP_AND_EXPORTFUN -MD_EXPORTS DllCanUnloadNow(void) -{ - return FALSE; -} - -MD_EXPORTS DllRegisterServer(void) -{ - return S_OK; -} -MD_EXPORTS DllUnregisterServer(void) -{ - return S_OK; -} \ No newline at end of file diff --git a/adapterpy/pytoc.png b/adapterpy/pytoc.png deleted file mode 100644 index c9f4e91c8adad02a43256421b11d55a9e559dee5..0000000000000000000000000000000000000000 Binary files a/adapterpy/pytoc.png and /dev/null differ diff --git a/adapterpy/stdafx.cpp b/adapterpy/stdafx.cpp deleted file mode 100644 index 6df3550ce81cc351d786ce90d7c996762fce08ab..0000000000000000000000000000000000000000 --- a/adapterpy/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// Plugin.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/adapterpy/stdafx.h b/adapterpy/stdafx.h deleted file mode 100644 index 0f2c0d7f86b6e301819d097dff60d953c4c755cc..0000000000000000000000000000000000000000 --- a/adapterpy/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#ifndef _STDAFX_H_ -#define _STDAFX_H_ - -#include - -#include -#include -#include -#include -using namespace by; - -#include -#include - -#endif \ No newline at end of file diff --git a/adapterpy/targetver.h b/adapterpy/targetver.h deleted file mode 100644 index 203dfbcf61107432f6b42793715d96f7b06d5802..0000000000000000000000000000000000000000 --- a/adapterpy/targetver.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -// The following macros define the minimum required platform. The minimum required platform -// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run -// your application. The macros work by enabling all features available on platform versions up to and -// including the version specified. - -// Modify the following defines if you have to target a platform prior to the ones specified below. -// Refer to MSDN for the latest info on corresponding values for different platforms. -#ifndef WINVER // Specifies that the minimum required platform is Windows Vista. -#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. -#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98. -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. -#endif - -#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0. -#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE. -#endif diff --git a/adapterjs/adapterjavascriptimpl.cpp b/adapters/adapterjavascriptimpl.cpp similarity index 88% rename from adapterjs/adapterjavascriptimpl.cpp rename to adapters/adapterjavascriptimpl.cpp index dfd3d33321b32b77f7b427f5ecd82215108ad851..f491a1917fae862428d2518f245ff1ce5a620ffa 100644 --- a/adapterjs/adapterjavascriptimpl.cpp +++ b/adapters/adapterjavascriptimpl.cpp @@ -8,7 +8,7 @@ CAdapterjavascriptImpl::~CAdapterjavascriptImpl(void) { } ////////////////////////////////////////////////////////////////////////// -std_method_impl CAdapterjavascriptImpl::init_class(IModuleBase* prot, IModuleBase* punkOuter) +std_method_impl CAdapterjavascriptImpl::init_class(IBase* prot, IBase* punkOuter) { HRESULT hr = S_OK; if (prot != NULL) diff --git a/adapterjs/adapterjavascriptimpl.h b/adapters/adapterjavascriptimpl.h similarity index 81% rename from adapterjs/adapterjavascriptimpl.h rename to adapters/adapterjavascriptimpl.h index 74b72878e7a85f5f5ecbd27521073619d3a02e55..efd2c1f29a53cc66d1a0184308913fcd3798ec19 100644 --- a/adapterjs/adapterjavascriptimpl.h +++ b/adapters/adapterjavascriptimpl.h @@ -1,12 +1,12 @@ -#ifndef _ASYNIOIMPL_H_ -#define _ASYNIOIMPL_H_ +#ifndef _JSIMPL_H_ +#define _JSIMPL_H_ #include "stdafx.h" #include class CAdapterjavascriptImpl : public IAdapterJavaScript, - public IMdPlugin, - public IMdPluginRun, + public IPlugin, + public IPluginRun, public CUnknownImp { public: @@ -14,11 +14,11 @@ public: virtual ~CAdapterjavascriptImpl(void); - UNKNOWN_IMP3_(IMdPlugin, IMdPluginRun,IAdapterJavaScript); + UNKNOWN_IMP3_(IPlugin, IPluginRun,IAdapterJavaScript); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// - std_method_impl init_class(IModuleBase* prot, IModuleBase* punkOuter); + std_method_impl init_class(IBase* prot, IBase* punkOuter); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// diff --git a/adapterlua/adapterluaimpl.cpp b/adapters/adapterluaimpl.cpp similarity index 95% rename from adapterlua/adapterluaimpl.cpp rename to adapters/adapterluaimpl.cpp index 86170883fe6057b1e228d45fede4fd1c42d91d7e..c835954003643ce8032871808d1dffbc3cb5b2e2 100644 --- a/adapterlua/adapterluaimpl.cpp +++ b/adapters/adapterluaimpl.cpp @@ -8,7 +8,7 @@ CAdapterluaImpl::~CAdapterluaImpl(void) { } ////////////////////////////////////////////////////////////////////////// -std_method_impl CAdapterluaImpl::init_class(IModuleBase* prot, IModuleBase* punkOuter) +std_method_impl CAdapterluaImpl::init_class(IBase* prot, IBase* punkOuter) { HRESULT hr = S_OK; if (prot != NULL) diff --git a/adapterlua/adapterluaimpl.h b/adapters/adapterluaimpl.h similarity index 86% rename from adapterlua/adapterluaimpl.h rename to adapters/adapterluaimpl.h index fa431a93119f3de27efae5c5ec8cb1888f06b40b..a4e83df7f14dbadd30d3c74360ef1e032b5d9ffa 100644 --- a/adapterlua/adapterluaimpl.h +++ b/adapters/adapterluaimpl.h @@ -1,5 +1,5 @@ -#ifndef _ASYNIOIMPL_H_ -#define _ASYNIOIMPL_H_ +#ifndef _LUAIMPL_H_ +#define _LUAIMPL_H_ #include "stdafx.h" #include @@ -13,8 +13,8 @@ extern "C" } class CAdapterluaImpl : public IAdapterLua, - public IMdPlugin, - public IMdPluginRun, + public IPlugin, + public IPluginRun, public CUnknownImp { public: @@ -22,11 +22,11 @@ public: virtual ~CAdapterluaImpl(void); - UNKNOWN_IMP3_(IMdPlugin, IMdPluginRun,IAdapterLua); + UNKNOWN_IMP3_(IPlugin, IPluginRun,IAdapterLua); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// - std_method_impl init_class(IModuleBase* prot, IModuleBase* punkOuter); + std_method_impl init_class(IBase* prot, IBase* punkOuter); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// diff --git a/adapterpy/adapterpyimpl.cpp b/adapters/adapterpyimpl.cpp similarity index 94% rename from adapterpy/adapterpyimpl.cpp rename to adapters/adapterpyimpl.cpp index daed22f1d4817eda7318b99116079b2d15a2e659..14cb717b49c588a15d5868584b1a37d2cd1cc1d3 100644 --- a/adapterpy/adapterpyimpl.cpp +++ b/adapters/adapterpyimpl.cpp @@ -8,7 +8,7 @@ CAdapterpyImpl::~CAdapterpyImpl(void) { } ////////////////////////////////////////////////////////////////////////// -std_method_impl CAdapterpyImpl::init_class(IModuleBase* prot, IModuleBase* punkOuter) +std_method_impl CAdapterpyImpl::init_class(IBase* prot, IBase* punkOuter) { HRESULT hr = S_OK; if (prot != NULL) diff --git a/adapterpy/adapterpyimpl.h b/adapters/adapterpyimpl.h similarity index 82% rename from adapterpy/adapterpyimpl.h rename to adapters/adapterpyimpl.h index a764a730e6573f54f4cf5047c7f9ab46204a1640..534768d59f831802ba6b06fdf359494837b03b66 100644 --- a/adapterpy/adapterpyimpl.h +++ b/adapters/adapterpyimpl.h @@ -1,5 +1,5 @@ -#ifndef _ASYNIOIMPL_H_ -#define _ASYNIOIMPL_H_ +#ifndef _PYIMPL_H_ +#define _PYIMPL_H_ #include "stdafx.h" #include @@ -8,8 +8,8 @@ class CAdapterpyImpl : public IAdapterPy, - public IMdPlugin, - public IMdPluginRun, + public IPlugin, + public IPluginRun, public CUnknownImp { public: @@ -17,11 +17,11 @@ public: virtual ~CAdapterpyImpl(void); - UNKNOWN_IMP3_(IMdPlugin, IMdPluginRun,IAdapterPy); + UNKNOWN_IMP3_(IPlugin, IPluginRun,IAdapterPy); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// - std_method_impl init_class(IModuleBase* prot, IModuleBase* punkOuter); + std_method_impl init_class(IBase* prot, IBase* punkOuter); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// diff --git a/adapters/adapters.vcxproj b/adapters/adapters.vcxproj index 741e9e7cfd018572d724396c51265b6cd711a48f..57ca412adeb9dcab451485522a89e3335531f640 100644 --- a/adapters/adapters.vcxproj +++ b/adapters/adapters.vcxproj @@ -109,6 +109,9 @@ + + + @@ -124,6 +127,9 @@ + + + diff --git a/adapters/adaptersimpl.cpp b/adapters/adaptersimpl.cpp index eba8733fa44df18703b6b077f9fc1cf5eb063d73..7154adecec77d424352b6f99c6a0ffa5ee9546bf 100644 --- a/adapters/adaptersimpl.cpp +++ b/adapters/adaptersimpl.cpp @@ -8,7 +8,7 @@ CAdaptersImpl::~CAdaptersImpl(void) { } ////////////////////////////////////////////////////////////////////////// -std_method_impl CAdaptersImpl::init_class(IModuleBase* prot, IModuleBase* punkOuter) +std_method_impl CAdaptersImpl::init_class(IBase* prot, IBase* punkOuter) { HRESULT hr = S_OK; if (prot != NULL) diff --git a/adapters/adaptersimpl.h b/adapters/adaptersimpl.h index 316eedcb89a8cf18439a1704056a843a749b93d6..1fc2175d734c5a5e606cf5e9bc28164b6ab9c93f 100644 --- a/adapters/adaptersimpl.h +++ b/adapters/adaptersimpl.h @@ -6,8 +6,8 @@ #include class CAdaptersImpl : public IAdapters, - public IMdPlugin, - public IMdPluginRun, + public IPlugin, + public IPluginRun, public CUnknownImp { public: @@ -15,11 +15,11 @@ public: virtual ~CAdaptersImpl(void); - UNKNOWN_IMP3_(IMdPlugin, IMdPluginRun,IAdapters); + UNKNOWN_IMP3_(IPlugin, IPluginRun,IAdapters); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// - std_method_impl init_class(IModuleBase* prot, IModuleBase* punkOuter); + std_method_impl init_class(IBase* prot, IBase* punkOuter); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// diff --git a/adapterjs/addon.cpp b/adapters/addon.cpp similarity index 100% rename from adapterjs/addon.cpp rename to adapters/addon.cpp diff --git a/adapterjs/binding.gyp b/adapters/binding.gyp similarity index 100% rename from adapterjs/binding.gyp rename to adapters/binding.gyp diff --git a/adapters/dllmain.cpp b/adapters/dllmain.cpp index 2fb26eff5e529c65dc7a1684e6720d091c34cc18..f1225fe3a646d12673043b31e6977b1466016e48 100644 --- a/adapters/dllmain.cpp +++ b/adapters/dllmain.cpp @@ -1,6 +1,9 @@ // dllmain.cpp : Defines the entry point for the DLL application. #include "stdafx.h" #include "adaptersimpl.h" +#include "adapterjavascriptimpl.h" +#include "adapterluaimpl.h" +#include "adapterpyimpl.h" BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, @@ -22,6 +25,9 @@ BOOL APIENTRY DllMain( HMODULE hModule, BEGIN_CLIDMAP CLIDMAPENTRY_BEGIN CLIDMAPENTRY_PROGID(CLSID_Adapters, CAdaptersImpl,"Adapters.Impl") + CLIDMAPENTRY_PROGID(CLSID_AdapaterJavaScript, CAdapterjavascriptImpl, "Adapterjavascript.Impl") + CLIDMAPENTRY_PROGID(CLSID_AdapaterLua, CAdapterluaImpl, "Adapterlua.Impl") + CLIDMAPENTRY_PROGID(CLSID_AdapterPy, CAdapterpyImpl, "Adapterpy.Impl") CLIDMAPENTRY_END END_CLIDMAP_AND_EXPORTFUN diff --git a/adapterjs/test.js b/adapters/test.js similarity index 100% rename from adapterjs/test.js rename to adapters/test.js diff --git a/asynio/CMakeLists.txt b/asynio/CMakeLists.txt index ef422f9867121a48a3e4feee090f69d1d511c959..bd32b4162fd0ce35cec66ac0f6bb6952aa0138a7 100644 --- a/asynio/CMakeLists.txt +++ b/asynio/CMakeLists.txt @@ -5,7 +5,8 @@ set(asynio_src dllmain.cpp filewriteimpl.cpp asynioimpl.cpp tcpsocketimpl.cpp - sys_file.cpp) + impl/sys_file.cpp + impl/fileop.cpp) if (${UNIX_OS}) diff --git a/asynio/asynctcpsocketimpl.cpp b/asynio/asynctcpsocketimpl.cpp index 3db949b1414106585a1b49bd28bb36ea5febd8fb..f6960580c5e3a0fd471c07c412af942cef59d034 100644 --- a/asynio/asynctcpsocketimpl.cpp +++ b/asynio/asynctcpsocketimpl.cpp @@ -9,36 +9,50 @@ CAsyncTcpSocketImpl::~CAsyncTcpSocketImpl() } ////////////////////////////////////////////////////////////////////////// -std_method_impl CAsyncTcpSocketImpl::CreateSocket() +std_method_impl CAsyncTcpSocketImpl::ReadIo(IIoOperation* pOperation) { - HRESULT hr = S_OK; - - m_socketFd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); + HRESULT hr = S_OK; - if (m_socketFd == INVALID_SOCKET) { - return E_FAIL; - } + return hr; +} +std_method_impl CAsyncTcpSocketImpl::WriteIo(IIoOperation* pOperation) +{ + HRESULT hr = S_OK; return hr; } +std_method_impl CAsyncTcpSocketImpl::ReadAllIo(IIoOperation* pOperation) +{ + HRESULT hr = S_OK; -std_method_impl CAsyncTcpSocketImpl::CloseSocket() + return hr; +} +std_method_impl CAsyncTcpSocketImpl::WriteAllIo(IIoOperation* pOperation) { - HRESULT hr = S_OK; + HRESULT hr = S_OK; return hr; } -std_method_type_impl(os_sock_t) CAsyncTcpSocketImpl::GetSocket() +std_method_impl CAsyncTcpSocketImpl::CloseIo() { - return m_socketFd; + HRESULT hr = S_OK; + + return hr; } -std_method_type_impl(ssize_t) CAsyncTcpSocketImpl::Send(const char* buf,size_t len,int flags) +std_method_impl CAsyncTcpSocketImpl::OpenIo() { - return -1; + HRESULT hr = S_OK; + + m_socketFd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); + + if (m_socketFd == INVALID_SOCKET) { + return E_FAIL; + } + return hr; } -std_method_type_impl(ssize_t) CAsyncTcpSocketImpl::Recv(char* addr,size_t len,int flags) +std_method_type_impl(os_sock_t) CAsyncTcpSocketImpl::GetSocket() { - return -1; + return m_socketFd; } diff --git a/asynio/asynctcpsocketimpl.h b/asynio/asynctcpsocketimpl.h index 5a3e010fc251dc8addc572a17efdd79790e7f39b..53ef82c122a55ffe73016552bdf7641ab198d611 100644 --- a/asynio/asynctcpsocketimpl.h +++ b/asynio/asynctcpsocketimpl.h @@ -3,7 +3,6 @@ #include "stdafx.h" #include -#include "iotcpbase.h" class CAsyncTcpSocketImpl : public IAsyncTcpSocket, public CUnknownImp @@ -14,12 +13,16 @@ public: virtual ~CAsyncTcpSocketImpl(void); UNKNOWN_IMP1(IAsyncTcpSocket); ////////////////////////////////////////////////////////////////////////// + //IIoDevice + std_method(ReadIo)(IIoOperation* pOperation); + std_method(WriteIo)(IIoOperation* pOperation); + std_method(ReadAllIo)(IIoOperation* pOperation); + std_method(WriteAllIo)(IIoOperation* pOperation); + std_method(CloseIo)(); + std_method(OpenIo)(); + ////////////////////////////////////////////////////////////////////////// //ISocket - std_method(CreateSocket)(); - std_method(CloseSocket)(); - std_method_(ssize_t,Send)(const char* buf,size_t len,int flags); - std_method_(ssize_t,Recv)(char* addr,size_t len,int flags); - std_method_(os_sock_t,GetSocket)(); + std_method_(os_sock_t, GetSocket)(); ////////////////////////////////////////////////////////////////////////// //ITcpSocket std_method(Bind)(const char* addr, unsigned int uport); @@ -41,7 +44,6 @@ public: std_method(RecvLoWat)(int size); ////////////////////////////////////////////////////////////////////////// os_sock_t m_socketFd; - //io_tcp_impl m_ioc; private: diff --git a/asynio/asynio.vcxproj b/asynio/asynio.vcxproj index 0b9af1ca4bfdbfa72082a154e498fdec39c58261..8b9e3b1b564706f664c414ce54a9dd47b59ffc96 100644 --- a/asynio/asynio.vcxproj +++ b/asynio/asynio.vcxproj @@ -117,10 +117,13 @@ + + + + - @@ -131,12 +134,15 @@ + + + + - diff --git a/asynio/asynioimpl.cpp b/asynio/asynioimpl.cpp index 0eb775fa7cbc5566458b6153d68249c7366c2455..8d82dce8d1ceaf0573fab15680606fc46bd64c74 100644 --- a/asynio/asynioimpl.cpp +++ b/asynio/asynioimpl.cpp @@ -12,7 +12,7 @@ CAsynIoImpl::~CAsynIoImpl(void) { } ////////////////////////////////////////////////////////////////////////// -std_method_impl CAsynIoImpl::init_class(IModuleBase* prot, IModuleBase* punkOuter) +std_method_impl CAsynIoImpl::init_class(IBase* prot, IBase* punkOuter) { HRESULT hr = S_OK; if (prot != NULL) @@ -44,59 +44,42 @@ std_method_impl CAsynIoImpl::Stop() HRESULT hr = S_OK; return hr; } -std_method_impl CAsynIoImpl::CreateReadFile(IReadFile** pReadFile) +std_method_impl CAsynIoImpl::CreateReadFile(IBase** pReadFile) { - HRESULT hr = S_OK; - IReadFile* pObject = NULL; - pObject = new CFileReadImpl; - pObject->AddRef(); - *pReadFile = reinterpret_cast(pObject); - return hr; + CFileReadImpl* pObject = NULL; + pObject = new CFileReadImpl; + return pObject->QueryInterface(_uuidof(IReadFile), (void**)pReadFile);; } -std_method_impl CAsynIoImpl::CreateWriteFile(IWriteFile** pWriteFile) +std_method_impl CAsynIoImpl::CreateWriteFile(IBase** pWriteFile) { - HRESULT hr = S_OK; - IWriteFile* pObject = NULL; - pObject = new CFileWriteImpl; - pObject->AddRef(); - - *pWriteFile = reinterpret_cast(pObject); - return hr; + CFileWriteImpl* pObject = NULL; + pObject = new CFileWriteImpl; + return pObject->QueryInterface(_uuidof(IWriteFile), (void**)pWriteFile); } -std_method_impl CAsynIoImpl::CreateAsyncTcpSocket(IAsyncTcpSocket** pAsynTcpSocket) +std_method_impl CAsynIoImpl::CreateAsyncTcpSocket(IBase** pAsynTcpSocket) { - HRESULT hr = S_OK; - - IAsyncTcpSocket* pObject = NULL; - pObject = new CAsyncTcpSocketImpl; - pObject->AddRef(); - *pAsynTcpSocket = reinterpret_cast(pObject); - - return hr; + CAsyncTcpSocketImpl* pObject = NULL; + pObject = new CAsyncTcpSocketImpl; + return pObject->QueryInterface(_uuidof(IAsyncTcpSocket), (void**)pAsynTcpSocket); } -std_method_impl CAsynIoImpl::CreateTcpSocket(ITcpSocket** pTcpSocket) +std_method_impl CAsynIoImpl::CreateTcpSocket(IBase** pTcpSocket) { - HRESULT hr = S_OK; - - ITcpSocket* pObject = NULL; - pObject = new CTcpSocketImpl; - pObject->AddRef(); - *pTcpSocket = reinterpret_cast(pObject); - - return hr; + CTcpSocketImpl* pObject = NULL; + pObject = new CTcpSocketImpl; + return pObject->QueryInterface(_uuidof(ITcpSocket), (void**)pTcpSocket); } -std_method_impl CAsynIoImpl::CreateAsyncUdpSocket(IAsyncUdpSocket** pAsynUdpSocket) +std_method_impl CAsynIoImpl::CreateAsyncUdpSocket(IBase** pAsynUdpSocket) { HRESULT hr = S_OK; return hr; } -std_method_impl CAsynIoImpl::CreateUdpSocket(IUdpSocket** pUdpSocket) +std_method_impl CAsynIoImpl::CreateUdpSocket(IBase** pUdpSocket) { HRESULT hr = S_OK; return hr; } -std_method_impl CAsynIoImpl::DeleteIo(IModuleBase* pAsynIo) +std_method_impl CAsynIoImpl::DeleteIo(IBase* pAsynIo) { HRESULT hr = S_OK; if (pAsynIo != NULL) diff --git a/asynio/asynioimpl.h b/asynio/asynioimpl.h index 36314a7359c021daa0e4c29e1a5a985f89bbea72..a7e5c6aacf91c79ea84942cdfd56e83dd2691fe3 100644 --- a/asynio/asynioimpl.h +++ b/asynio/asynioimpl.h @@ -6,8 +6,8 @@ class CAsynIoImpl : public IAsynIo, - public IMdPlugin, - public IMdPluginRun, + public IPlugin, + public IPluginRun, public CUnknownImp { public: @@ -15,11 +15,11 @@ public: virtual ~CAsynIoImpl(void); - UNKNOWN_IMP3_(IMdPlugin, IMdPluginRun,IAsynIo); + UNKNOWN_IMP3_(IPlugin, IPluginRun,IAsynIo); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// - std_method_impl init_class(IModuleBase* prot, IModuleBase* punkOuter); + std_method_impl init_class(IBase* prot, IBase* punkOuter); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -34,13 +34,13 @@ public: ////////////////////////////////////////////////////////////////////////// - std_method(CreateReadFile)(IReadFile** pReadFile); - std_method(CreateWriteFile)(IWriteFile** pWriteFile); - std_method(CreateAsyncTcpSocket)(IAsyncTcpSocket** pAsynTcpSocket); - std_method(CreateTcpSocket)(ITcpSocket** pTcpSocket); - std_method(CreateAsyncUdpSocket)(IAsyncUdpSocket** pAsynUdpSocket); - std_method(CreateUdpSocket)(IUdpSocket** pUdpSocket); - std_method(DeleteIo)(IModuleBase* pAsynIo); + std_method(CreateReadFile)(IBase** pReadFile); + std_method(CreateWriteFile)(IBase** pWriteFile); + std_method(CreateAsyncTcpSocket)(IBase** pAsynTcpSocket); + std_method(CreateTcpSocket)(IBase** pTcpSocket); + std_method(CreateAsyncUdpSocket)(IBase** pAsynUdpSocket); + std_method(CreateUdpSocket)(IBase** pUdpSocket); + std_method(DeleteIo)(IBase* pAsynIo); private: _lComPtr m_pRot; diff --git a/asynio/filereadimpl.cpp b/asynio/filereadimpl.cpp index 3731d99b61a04a3e12a3750983b14da855316c56..ef284d6c06276bd88157da64f38be44832c24198 100644 --- a/asynio/filereadimpl.cpp +++ b/asynio/filereadimpl.cpp @@ -2,11 +2,12 @@ CFileReadImpl::CFileReadImpl(void) { - + loadFileInstance(&FileOpt); + m_hFile = FILE_INVALID; } CFileReadImpl::~CFileReadImpl(void) { - + CloseFile(); } ////////////////////////////////////////////////////////////////////////// std_method_impl CFileReadImpl::LoadFile(const TCHAR* pszLoadFile, @@ -17,7 +18,7 @@ std_method_impl CFileReadImpl::LoadFile(const TCHAR* pszLoadFile, { HRESULT hr = S_OK; - m_hFile.m_p = by_file_open(pszLoadFile, O_RDWR, 0644); + m_hFile = FileOpt.Open(pszLoadFile, O_RDWR, 0644); return hr; } @@ -25,18 +26,23 @@ std_method_impl CFileReadImpl::CloseFile() { HRESULT hr = S_OK; + if (m_hFile != FILE_INVALID) + { + FileOpt.Close(m_hFile); + m_hFile = FILE_INVALID; + } return hr; } -std_method_type_impl(byint64) CFileReadImpl::GetFileSize() +std_method_type_impl(os_int64) CFileReadImpl::GetFileSize() { - return by_file_fsize(m_hFile.m_p); + return FileOpt.fSize(m_hFile); } -std_method_impl CFileReadImpl::ReadBuffer(char* szBuffer,byint64 ulReadFileLen, byint64* ulReadSize) +std_method_impl CFileReadImpl::ReadBuffer(char* szBuffer,os_int64 ulReadFileLen, os_int64* ulReadSize) { HRESULT hr = S_OK; - *ulReadSize = by_file_read(m_hFile.m_p, szBuffer, ulReadFileLen); + *ulReadSize = FileOpt.Read(m_hFile, szBuffer, ulReadFileLen); return hr; } diff --git a/asynio/filereadimpl.h b/asynio/filereadimpl.h index ccb245bea1f1b053ebf3f5f94a85bef5632aa1a0..b24728dcca52e13be4a29843096b40d2bb4f6c8e 100644 --- a/asynio/filereadimpl.h +++ b/asynio/filereadimpl.h @@ -5,7 +5,7 @@ #include #include -#include "sys_file.h" +#include "impl/fileop.h" class CFileReadImpl : public IReadFile, public CUnknownImp @@ -14,7 +14,6 @@ public: CFileReadImpl(void); virtual ~CFileReadImpl(void); UNKNOWN_IMP1(IReadFile); - ////////////////////////////////////////////////////////////////////////// std_method(LoadFile)(const TCHAR* pszLoadFile, unsigned long ulwDesiredAccess, @@ -22,34 +21,12 @@ public: unsigned long ulCreationDisposition, unsigned long ulFlagsAndAttributes); std_method(CloseFile)(); - std_method_(byint64,GetFileSize)(); - std_method(ReadBuffer)(char* szBuffer, byint64 ulReadFileLen, byint64* ulReadSize); + std_method_(os_int64,GetFileSize)(); + std_method(ReadBuffer)(char* szBuffer, os_int64 ulReadFileLen, os_int64* ulReadSize); std_method(AsynReadBuffer)(const char* szNodeName,char* szNodeInfo); - private: - - struct file_sentry - { - static FILE_HANDLE default_value() - { - return 0; - } - template static bool equal_to(_Ptr l, _Ptr r) - { - return l == r; - } - template static void destroy(_Ptr p) - { - if (p != 0) - { - by_file_close(p); - p = 0; - } - } - }; - - - sentrym_hFile; + os_fd_t m_hFile; + FileImpl FileOpt; }; #endif diff --git a/asynio/impl/fileop.cpp b/asynio/impl/fileop.cpp new file mode 100644 index 0000000000000000000000000000000000000000..712442f2a9745c9b4b4baea12420d68ea14ce3aa --- /dev/null +++ b/asynio/impl/fileop.cpp @@ -0,0 +1,14 @@ +#include "fileop.h" +#include "sys_file.h" + +void loadFileInstance(FileImpl* fileop) { + fileop->Open = os_file_open; + fileop->Close = os_file_close; + fileop->Read = os_file_read; + fileop->Write = os_file_write; + fileop->Seek = os_file_lseek; + fileop->fSize = os_file_fsize; + +} + + diff --git a/asynio/impl/fileop.h b/asynio/impl/fileop.h new file mode 100644 index 0000000000000000000000000000000000000000..4475b103552f54f35d3994cff0224f987fbbbbc7 --- /dev/null +++ b/asynio/impl/fileop.h @@ -0,0 +1,25 @@ +#ifndef _FILEOP_H_ +#define _FILEOP_H_ + +#include + +typedef os_fd_t(*OpenFileFunc)(const TCHAR *filepath, int flags, int mode); +typedef int(*CloseFileFunc)(os_fd_t fh); +typedef _off_t(*SeekFileFunc)(os_fd_t fh, _off_t offset, int whence); +typedef int(*ReadFileFunc)(os_fd_t fh, void *buf, size_t size); +typedef int(*WriteFileFunc)(os_fd_t fh, const void *buf, size_t size); +typedef os_int64(*fSizeFileFunc)(os_fd_t fh); + +typedef struct TagFileImpl { + OpenFileFunc Open; + CloseFileFunc Close; + SeekFileFunc Seek; + ReadFileFunc Read; + WriteFileFunc Write; + fSizeFileFunc fSize; +}FileImpl; + +void loadFileInstance(FileImpl* fileop); + +#endif // ! _FILEOP_H_ + diff --git a/asynio/sys_file.cpp b/asynio/impl/sys_file.cpp similarity index 78% rename from asynio/sys_file.cpp rename to asynio/impl/sys_file.cpp index 6a0b7f9ce2fdf28a0c63c52c7f8e311486c1f06f..4f75baa42677d4b177233f31d0f0560a02496960 100644 --- a/asynio/sys_file.cpp +++ b/asynio/impl/sys_file.cpp @@ -1,8 +1,7 @@ -#include "stdafx.h" #include "sys_file.h" #ifdef _MSC_VER -FILE_HANDLE by_file_open(const TCHAR *filepath, int flags, int mode) +os_fd_t os_file_open(const TCHAR *filepath, int flags, int mode) { FILE_HANDLE fh; DWORD fileaccess = 0, fileshare = 0, filecreate = 0, fileattr = 0; @@ -57,11 +56,11 @@ FILE_HANDLE by_file_open(const TCHAR *filepath, int flags, int mode) filecreate, fileattr, NULL); return fh; } -int by_file_close(FILE_HANDLE fh) +int os_file_close(os_fd_t fh) { return CloseHandle(fh) ? 0 : -1; } -_off_t by_lseek(FILE_HANDLE fh, _off_t offset, int whence) +_off_t os_file_lseek(os_fd_t fh, _off_t offset, int whence) { LARGE_INTEGER li; DWORD method; @@ -83,24 +82,24 @@ _off_t by_lseek(FILE_HANDLE fh, _off_t offset, int whence) } return li.QuadPart; } -int by_file_read(FILE_HANDLE fh, void *buf, size_t size) +int os_file_read(os_fd_t fh, void *buf, size_t size) { DWORD nRead = 0; if (!ReadFile(fh, buf, (DWORD) size, &nRead, NULL)) return -1; return nRead; } -int by_file_write(FILE_HANDLE fh, const void *buf, size_t size) +int os_file_write(os_fd_t fh, const void *buf, size_t size) { DWORD nWritten = 0; if (!WriteFile(fh, buf, (DWORD) size, &nWritten, NULL)) return -1; return nWritten; } -byint64 by_file_fsize(FILE_HANDLE fh) +os_int64 os_file_fsize(os_fd_t fh) { DWORD nLow, nHigh; - byint64 n; + os_int64 n; nLow = GetFileSize(fh, &nHigh); if (nLow == 0xFFFFFFFF) return -1; @@ -108,27 +107,27 @@ byint64 by_file_fsize(FILE_HANDLE fh) return nLow + (n << 32); } #else -FILE_HANDLE by_file_open(const TCHAR *filepath, int flags, int mode) +os_fd_t os_file_open(const TCHAR *filepath, int flags, int mode) { return open(filepath, flags, mode); } -int by_file_close(FILE_HANDLE fh) +int os_file_close(FILE_HANDLE fh) { return close(fh); } -_off_t by_lseek(FILE_HANDLE fh, _off_t offset, int whence) +_off_t os_file_lseek(os_fd_t fh, _off_t offset, int whence) { return lseek(fh, offset, whence); } -int by_file_read(FILE_HANDLE fh, void *buf, size_t size) +int os_file_read(os_fd_t fh, void *buf, size_t size) { return (int) read(fh, buf, size); } -int by_file_write(FILE_HANDLE fh, const void *buf, size_t size) +int os_file_write(os_fd_t fh, const void *buf, size_t size) { return (int) write(fh, buf, size); } -byint64 by_file_fsize(FILE_HANDLE fh) +os_int64 os_file_fsize(os_fd_t fh) { struct stat sbuf; if (fstat(fh, &sbuf) == -1) diff --git a/asynio/impl/sys_file.h b/asynio/impl/sys_file.h new file mode 100644 index 0000000000000000000000000000000000000000..1e234abd29274e71abe421d87199505a00ce7676 --- /dev/null +++ b/asynio/impl/sys_file.h @@ -0,0 +1,15 @@ +#ifndef SYS_FILE_H_ +#define SYS_FILE_H_ + +#include + +os_fd_t os_file_open(const TCHAR *filepath, int flags, int mode); +int os_file_close(os_fd_t fh); +_off_t os_file_lseek(os_fd_t fh, _off_t offset, int whence); +int os_file_read(os_fd_t fh, void *buf, size_t size); +int os_file_write(os_fd_t fh, const void *buf, size_t size); +os_int64 os_file_fsize(os_fd_t fh); + + + +#endif diff --git a/asynio/ioeventbaseimpl.cpp b/asynio/ioeventbaseimpl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1b8842d6ae07296e28dcecf6fc1ef72e418d2b84 --- /dev/null +++ b/asynio/ioeventbaseimpl.cpp @@ -0,0 +1,90 @@ +#include "ioeventbaseimpl.h" +#include "iooperationimpl.h" + +CEventBaseImpl::CEventBaseImpl(void) +{ +} + +CEventBaseImpl::~CEventBaseImpl(void) +{ +} +////////////////////////////////////////////////////////////////////////// +std_method_impl CEventBaseImpl::init_class(IBase* prot, IBase* punkOuter) +{ + HRESULT hr = S_OK; + if (prot != NULL) + { + m_pRot = prot; + } + return hr; +} +std_method_impl CEventBaseImpl::Init(void*) +{ + return S_OK; +} +std_method_impl CEventBaseImpl::Uninit() +{ + return S_OK; +} +std_method_impl CEventBaseImpl::Start() +{ + return S_OK; +} +std_method_impl CEventBaseImpl::Stop() +{ + return S_OK; +} + +std_method_impl CEventBaseImpl::AttachMessageEvents(IMessageEvents *pEvents) +{ + return S_OK; +} +std_method_impl CEventBaseImpl::DetachMessageEvents(IMessageEvents *pEvents) +{ + return S_OK; +} +std_method_impl CEventBaseImpl::SendMessage(IMessageEvents *pEvents, + ULONG lMessageId, + ULONG lParam1, + ULONG lParam2) +{ + return S_OK; +} +std_method_impl CEventBaseImpl::PostMessage(IMessageEvents *pEvents, + ULONG lMessageId, + ULONG lParam1, + ULONG lParam2) +{ + return S_OK; +} +std_method_impl CEventBaseImpl::AddTimer(ITimerEvents *pEvents, + ULONG lTimerId, + ULONG lMilliSecond, + BOOL bCycled) +{ + return S_OK; +} +std_method_impl CEventBaseImpl::DelTimer(ITimerEvents *pEvents, ULONG lTimerId) +{ + return S_OK; +} +std_method_impl CEventBaseImpl::ClearTimer(ITimerEvents *pEvents) +{ + return S_OK; +} +std_method_impl CEventBaseImpl::CreateAsynIoOperation(IIoOperation **ppOperation) +{ + + CIoOperationImpl* Oper = NULL; + + Oper = new CIoOperationImpl; + + + + return S_OK; +} +std_method_impl CEventBaseImpl::PostAsynIoOperation(IIoOperation *pOperation) +{ + return S_OK; +} + diff --git a/asynio/ioeventbaseimpl.h b/asynio/ioeventbaseimpl.h new file mode 100644 index 0000000000000000000000000000000000000000..730d51fe9fb20c1cd7cb32a863dfc16b6e40f41f --- /dev/null +++ b/asynio/ioeventbaseimpl.h @@ -0,0 +1,62 @@ +#ifndef _IOEVENTBASE_H_ +#define _IOEVENTBASE_H_ + +#include "stdafx.h" +#include + +class CEventBaseImpl : public IEventBase, + public IPlugin, + public IPluginRun, + public CUnknownImp +{ +public: + CEventBaseImpl(void); + virtual ~CEventBaseImpl(void); + + UNKNOWN_IMP3_(IPlugin, IPluginRun, IEventBase); + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + std_method_impl init_class(IBase* prot, IBase* punkOuter); + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + std_method(Init)(void*); + std_method(Uninit)(); + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + std_method(Start)(); + std_method(Stop)(); + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + std_method(AttachMessageEvents)(IMessageEvents *pEvents); + std_method(DetachMessageEvents)(IMessageEvents *pEvents); + std_method(SendMessage)(IMessageEvents *pEvents, + ULONG lMessageId, + ULONG lParam1, + ULONG lParam2); + std_method(PostMessage)(IMessageEvents *pEvents, + ULONG lMessageId, + ULONG lParam1, + ULONG lParam2); + std_method(AddTimer)(ITimerEvents *pEvents, + ULONG lTimerId, + ULONG lMilliSecond, + BOOL bCycled); + std_method(DelTimer)(ITimerEvents *pEvents, ULONG lTimerId); + std_method(ClearTimer)(ITimerEvents *pEvents); + std_method(CreateAsynIoOperation)(IIoOperation **ppOperation); + std_method(PostAsynIoOperation)(IIoOperation *pOperation); + + ////////////////////////////////////////////////////////////////////////// +private: + _lComPtr m_pRot; + + + + + +}; +#endif \ No newline at end of file diff --git a/asynio/iooperationimpl.cpp b/asynio/iooperationimpl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..42e7d19a680f42c736305d38f0be2be419c74e43 --- /dev/null +++ b/asynio/iooperationimpl.cpp @@ -0,0 +1,77 @@ +#include "iooperationimpl.h" + +CIoOperationImpl::CIoOperationImpl() +{ + +} +CIoOperationImpl::~CIoOperationImpl() +{ + +} +////////////////////////////////////////////////////////////////////////// + +std_method_impl CIoOperationImpl::Bind(IIoOperationEvents* pEvent) +{ + return S_OK; +} +std_method_impl CIoOperationImpl::SetId(ULONG lId) +{ + return S_OK; +} +std_method_impl CIoOperationImpl::GetId(ULONG *pId) +{ + return S_OK; +} +std_method_impl CIoOperationImpl::SetResult(ERROR_CODE lErrorCode, + ULONG lTransferedBytes) +{ + return S_OK; +} +std_method_impl CIoOperationImpl::GetResult(ERROR_CODE *pErrorCode, + ULONG *pTransferedBytes) +{ + return S_OK; +} +std_method_impl CIoOperationImpl::AllocBuffer(ULONG lBufferSize) +{ + return S_OK; +} +std_method_impl CIoOperationImpl::GetBuffer(BUFFER_PTR *ppBuffer, + BUFFER_SIZE *pBufferSize) +{ + return S_OK; +} +std_method_impl CIoOperationImpl::ReleaseBuffer() +{ + return S_OK; +} +std_method_impl CIoOperationImpl::SetIoParam(ULONG lIoStartPos, ULONG lIoExpectBytes) +{ + return S_OK; +} +std_method_impl CIoOperationImpl::GetIoParam(ULONG* pIoStartPos, ULONG* pIoExpectBytes) +{ + return S_OK; +} +std_method_impl CIoOperationImpl::SetOperationPos(ULONGLONG lOperationPos) +{ + return S_OK; +} +std_method_impl CIoOperationImpl::GetOperationPos(ULONGLONG* pOperationPos) +{ + return S_OK; +} +std_method_impl CIoOperationImpl::SetResultInterface(IBase* lOperationPos) +{ + return S_OK; +} +std_method_impl CIoOperationImpl::GetResultInterface(IBase** pOperationPos) +{ + return S_OK; +} +std_method_impl CIoOperationImpl::Cancel() +{ + return S_OK; +} + + diff --git a/asynio/iooperationimpl.h b/asynio/iooperationimpl.h new file mode 100644 index 0000000000000000000000000000000000000000..a1a30c6e1e04de9c6e7e895003b548cf11ba9781 --- /dev/null +++ b/asynio/iooperationimpl.h @@ -0,0 +1,60 @@ +#ifndef _TCPSOCKIMPL_H_ +#define _TCPSOCKIMPL_H_ + +#include "stdafx.h" +#include + +class CIoOperationImpl : public IIoOperation, + public CUnknownImp + +{ +public: + CIoOperationImpl(void); + virtual ~CIoOperationImpl(void); + UNKNOWN_IMP1_MEM(IIoOperation); + + std_method_(ULONG, Release)() + { + atomicdel((LONG*)(LPVOID)&this->m_RefCount); + if (this->m_RefCount) + return this->m_RefCount; + delete this; + return 0; + } + + ////////////////////////////////////////////////////////////////////////// + //IIoOperation + std_method(Bind)(IIoOperationEvents* pEvent); + std_method(SetId)(ULONG lId); + std_method(GetId)(ULONG *pId); + std_method(SetResult)(ERROR_CODE lErrorCode, + ULONG lTransferedBytes); + std_method(GetResult)(ERROR_CODE *pErrorCode, + ULONG *pTransferedBytes); + std_method(AllocBuffer)(ULONG lBufferSize); + std_method(GetBuffer)(BUFFER_PTR *ppBuffer, + BUFFER_SIZE *pBufferSize); + std_method(ReleaseBuffer)(); + std_method(SetIoParam)(ULONG lIoStartPos, ULONG lIoExpectBytes); + std_method(GetIoParam)(ULONG* pIoStartPos, ULONG* pIoExpectBytes); + std_method(SetOperationPos)(ULONGLONG lOperationPos); + std_method(GetOperationPos)(ULONGLONG* pOperationPos); + std_method(SetResultInterface)(IBase* lOperationPos); + std_method(GetResultInterface)(IBase** pOperationPos); + std_method(Cancel)(); + + +private: + + + + +}; + + + + + + + +#endif \ No newline at end of file diff --git a/asynio/sys_file.h b/asynio/sys_file.h deleted file mode 100644 index 20e60ba48bae3ae49f89c83853646a1a81df611e..0000000000000000000000000000000000000000 --- a/asynio/sys_file.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef SYS_FILE_H_ -#define SYS_FILE_H_ - - -#ifdef _MSC_VER - -#define FILE_HANDLE HANDLE -#define FILE_INVALID INVALID_HANDLE_VALUE - -#elif defined(__GNUC__) - -# define FILE_HANDLE int -# define FILE_INVALID (int) -1 -#endif - -FILE_HANDLE by_file_open(const TCHAR *filepath, int flags, int mode); -int by_file_close(FILE_HANDLE fh); -_off_t by_lseek(FILE_HANDLE fh, _off_t offset, int whence); -int by_file_read(FILE_HANDLE fh, void *buf, size_t size); -int by_file_write(FILE_HANDLE fh, const void *buf, size_t size); -byint64 by_file_fsize(FILE_HANDLE fh); - - - -#endif // !SYS_FILE_H_ diff --git a/asynio/tcpsocketimpl.cpp b/asynio/tcpsocketimpl.cpp index 3d02c196d1bb9e343a2cbcf48e2577e64c659547..ee52503f6fc130cb323a2dde7ff722a9dab11920 100644 --- a/asynio/tcpsocketimpl.cpp +++ b/asynio/tcpsocketimpl.cpp @@ -9,41 +9,51 @@ CTcpSocketImpl::~CTcpSocketImpl() } ////////////////////////////////////////////////////////////////////////// +std_method_impl CTcpSocketImpl::ReadIo(IIoOperation* pOperation) +{ + HRESULT hr = S_OK; - -std_method_impl CTcpSocketImpl::CreateSocket() + return hr; +} +std_method_impl CTcpSocketImpl::WriteIo(IIoOperation* pOperation) { - HRESULT hr = S_OK; + HRESULT hr = S_OK; - m_socketFd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); + return hr; +} +std_method_impl CTcpSocketImpl::ReadAllIo(IIoOperation* pOperation) +{ + HRESULT hr = S_OK; - if (m_socketFd == INVALID_SOCKET) { - return E_FAIL; - } + return hr; +} +std_method_impl CTcpSocketImpl::WriteAllIo(IIoOperation* pOperation) +{ + HRESULT hr = S_OK; return hr; } +std_method_impl CTcpSocketImpl::CloseIo() +{ + HRESULT hr = S_OK; -std_method_impl CTcpSocketImpl::CloseSocket() + return hr; +} +std_method_impl CTcpSocketImpl::OpenIo() { HRESULT hr = S_OK; + m_socketFd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); + + if (m_socketFd == INVALID_SOCKET) { + return E_FAIL; + } return hr; } std_method_type_impl(os_sock_t) CTcpSocketImpl::GetSocket() { return m_socketFd; } -std_method_type_impl(ssize_t) CTcpSocketImpl::Send(const char* buf,size_t len,int flags) -{ - return -1; -} -std_method_type_impl(ssize_t) CTcpSocketImpl::Recv(char* addr,size_t len,int flags) -{ - return -1; -} - - std_method_impl CTcpSocketImpl::Bind(const char* addr, unsigned int uport) { HRESULT hr = S_OK; diff --git a/asynio/tcpsocketimpl.h b/asynio/tcpsocketimpl.h index 721579c19e050b0138309e156ba8f6fbfddf1469..12caec6f6655eaee9b3312a21a01d1967592c677 100644 --- a/asynio/tcpsocketimpl.h +++ b/asynio/tcpsocketimpl.h @@ -13,11 +13,15 @@ public: virtual ~CTcpSocketImpl(void); UNKNOWN_IMP1(ITcpSocket); ////////////////////////////////////////////////////////////////////////// + //IIoDevice + std_method(ReadIo)(IIoOperation* pOperation); + std_method(WriteIo)(IIoOperation* pOperation); + std_method(ReadAllIo)(IIoOperation* pOperation); + std_method(WriteAllIo)(IIoOperation* pOperation); + std_method(CloseIo)(); + std_method(OpenIo)(); + ////////////////////////////////////////////////////////////////////////// //ISocket - std_method(CreateSocket)(); - std_method(CloseSocket)(); - std_method_(ssize_t,Send)(const char* buf,size_t len,int flags); - std_method_(ssize_t,Recv)(char* addr,size_t len,int flags); std_method_(os_sock_t,GetSocket)(); ////////////////////////////////////////////////////////////////////////// //ITcpSocket diff --git a/comenv/comenv.cpp b/comenv/comenv.cpp index 7187c45833b722944616559f91ae76eb7547e7b6..bbfa0c30fc8bf44c44d49b9e931dd933f635ae32 100644 --- a/comenv/comenv.cpp +++ b/comenv/comenv.cpp @@ -38,7 +38,7 @@ ComEnv::~ComEnv(void) Uninit(); } -std_method_impl ComEnv::init_class(IModuleBase* prot, IModuleBase* punkOuter) +std_method_impl ComEnv::init_class(IBase* prot, IBase* punkOuter) { return !punkOuter ? S_OK : E_INVALIDARG; } @@ -75,7 +75,7 @@ std_method_type_impl(INT) ComEnv::Run() { return RunEnv(m_MainPlugin); } -HRESULT ComEnv::CreatePluginObject(CLSID csPulgin,IModuleBase** pModuleBase) +HRESULT ComEnv::CreatePluginObject(CLSID csPulgin,IBase** pModuleBase) { HRESULT hr = S_OK; @@ -84,7 +84,7 @@ HRESULT ComEnv::CreatePluginObject(CLSID csPulgin,IModuleBase** pModuleBase) _lComPtr pObejctLoader(m_pOlManager); retrtpv(pObejctLoader, E_FAIL); - hr = pObejctLoader->CreateInstance(m_pRot, m_MainPlugin, NULL, re_uuidof(IModuleBase), (void**)pModuleBase); + hr = pObejctLoader->CreateInstance(m_pRot, m_MainPlugin, NULL, _uuidof(IBase), (void**)pModuleBase); if(FAILED(hr)) { return E_FAIL; @@ -159,7 +159,7 @@ std_method_type_impl(INT) ComEnv::RunEnv(const CLSID& mainPlugin) else { - _lComPtr pRsPlugin(m_pMainPlugin); + _lComPtr pRsPlugin(m_pMainPlugin); if(!pRsPlugin) { return nRc; @@ -174,7 +174,7 @@ std_method_type_impl(INT) ComEnv::RunEnv(const CLSID& mainPlugin) m_pRot->Register(m_MainPlugin, m_pMainPlugin); - _lComPtr pRsPluginRun(m_pMainPlugin); + _lComPtr pRsPluginRun(m_pMainPlugin); if(pRsPluginRun) { nRc = pRsPluginRun->Start(); @@ -203,13 +203,13 @@ std_method_impl ComEnv::Uninit() return S_OK; } -std_method_impl ComEnv::GetRot(IModuleBase** pRot, IID iid/* = __uuidof(IComRunningObjectTable)*/) +std_method_impl ComEnv::GetRot(IBase** pRot, IID iid/* = __uuidof(IComRunningObjectTable)*/) { retrtpv(m_pRot, E_NOINTERFACE); return m_pRot->QueryInterface(iid, (void**)pRot); } -std_method_impl ComEnv::GetObjectLoader(IModuleBase** pRot, IID iid/* = __uuidof(IObjectLoader)*/) +std_method_impl ComEnv::GetObjectLoader(IBase** pRot, IID iid/* = __uuidof(IObjectLoader)*/) { retrtpv(m_pOlManager, E_NOINTERFACE); return m_pOlManager->QueryInterface(iid, (void**)pRot); @@ -239,7 +239,7 @@ std_method_impl ComEnv::NotifyExit(bool* bExit) { retrtpv(m_pRot, E_INVALIDARG); _lComPtr pExit; - RFAILED(m_pRot->GetObject(m_MainPlugin, re_uuidof(IExit), (IModuleBase**)&pExit)); + RFAILED(m_pRot->GetObject(m_MainPlugin, _uuidof(IExit), (IBase**)&pExit)); retrtpv(pExit, E_INVALIDARG); return pExit->NotifyExit(bExit); @@ -328,29 +328,29 @@ HRESULT ComEnv::loadOlAndRot() HRESULT hr = E_FAIL; - hr = DllGetClassObject(CLSID_CObjectLoader, re_uuidof(IComObjectFrameworkClassFactory), (void**)&pClassFactory); + hr = DllGetClassObject(CLSID_CObjectLoader, _uuidof(IComObjectFrameworkClassFactory), (void**)&pClassFactory); RFAILED(hr); retrtpv(pClassFactory, E_FAIL); - hr = pClassFactory->CreateInstance(NULL, NULL, re_uuidof(IOLManager), (void**)&m_pOlManager); + hr = pClassFactory->CreateInstance(NULL, NULL, _uuidof(IOLManager), (void**)&m_pOlManager); RFAILED(hr); retrtpv(m_pOlManager, E_FAIL); pClassFactory = INULL; ////////////////////////////////////////////////////////////////////////// - hr = DllGetClassObject(ClSID_CRunningObjectTable, re_uuidof(IComObjectFrameworkClassFactory), (void**)&pClassFactory); + hr = DllGetClassObject(ClSID_CRunningObjectTable, _uuidof(IComObjectFrameworkClassFactory), (void**)&pClassFactory); RFAILED(hr); retrtpv(pClassFactory, E_FAIL); - hr = pClassFactory->CreateInstance(NULL, NULL, re_uuidof(IComRunningObjectTable), (void**)&m_pRot); + hr = pClassFactory->CreateInstance(NULL, NULL, _uuidof(IComRunningObjectTable), (void**)&m_pRot); RFAILED(hr); retrtpv(m_pRot, E_FAIL); - _lComPtr pUnknown(m_pOlManager); + _lComPtr pUnknown(m_pOlManager); if(pUnknown) RFAILED(m_pRot->Register(CLSID_CObjectLoader, pUnknown)); - _lComPtr pUnknownEnv(this); + _lComPtr pUnknownEnv(this); if(pUnknownEnv) RFAILED(m_pRot->Register(CLSID_ComEnv, pUnknownEnv)); @@ -394,7 +394,7 @@ HRESULT ComEnv::loadConfigModule(bool bUseEnumObject) else { - HRESULT hr = xmlLoader.CreateInstance(CLSID_InfoAnalysis, NULL, NULL, re_uuidof(IInfoAnalysis), (void**)&pInfoAnalysis.m_p); + HRESULT hr = xmlLoader.CreateInstance(CLSID_InfoAnalysis, NULL, NULL, _uuidof(IInfoAnalysis), (void**)&pInfoAnalysis.m_p); if(FAILED(hr) || INULL == pInfoAnalysis) { return FALSE; @@ -494,12 +494,12 @@ HRESULT ComEnv::LoadComConfig(IInfoAnalysis* pAnalysis, bool bUseEnumObject) if (pAnalysis != INULL) { - InfoRoot* pRoot = NULL; - RFAILED(pAnalysis->NewLoadFileObject(m_strCfgFile.c_str(), (IModuleBase**)&pRoot)); + _lComPtr pRoot = INULL; + RFAILED(pAnalysis->NewLoadFileObject(m_strCfgFile.c_str(), (IBase**)&pRoot.m_p)); if (hr != S_OK) { } - if (pRoot != NULL) + if (pRoot != INULL) { InfoNode pProjectSettingRoot = NULL; InfoNode pClientModuleRoot = NULL; @@ -513,9 +513,6 @@ HRESULT ComEnv::LoadComConfig(IInfoAnalysis* pAnalysis, bool bUseEnumObject) RFAILED(LoadMaincom(pRoot, pClientModuleRoot)); RFAILED(LoadBasecom(pRoot, pClientModuleRoot)); } - - pAnalysis->DelObject(pRoot); - } else return E_FAIL; diff --git a/comenv/comenv.h b/comenv/comenv.h index 14239e4d8beacbb663a5e45436f3d63a413274a3..0aefd862c0d2b843461e7b8413963d2372157c25 100644 --- a/comenv/comenv.h +++ b/comenv/comenv.h @@ -15,7 +15,7 @@ public: ~ComEnv(void); UNKNOWN_IMP3_(IComEnv, IObjectRun, IExit); - std_method(init_class)(IModuleBase* prot, IModuleBase* punkOuter); + std_method(init_class)(IBase* prot, IBase* punkOuter); //IObjectRun std_method(Init)(HINSTANCE hInstance @@ -34,8 +34,8 @@ public: ); std_method_(INT, RunEnv)(const CLSID& mainPlugin); - std_method(GetRot)(IModuleBase** pRot, IID iid = re_uuidof(IComRunningObjectTable)); - std_method(GetObjectLoader)(IModuleBase** pRot, IID iid = re_uuidof(IObjectLoader)); + std_method(GetRot)(IBase** pRot, IID iid = _uuidof(IComRunningObjectTable)); + std_method(GetObjectLoader)(IBase** pRot, IID iid = _uuidof(IObjectLoader)); std_method_(LPCTSTR, GetXmlFile)(); std_method_(LPCTSTR, GetXmlLib)(); @@ -53,7 +53,7 @@ private: private: _lComPtr m_pOlManager; _lComPtr m_pRot; - _lComPtr m_pMainPlugin; + _lComPtr m_pMainPlugin; CLSID m_MainPlugin; @@ -94,7 +94,7 @@ private: HRESULT loadOlAndRot(); - HRESULT CreatePluginObject(CLSID csPulgin,IModuleBase** pModuleBase); + HRESULT CreatePluginObject(CLSID csPulgin,IBase** pModuleBase); HRESULT loadConfigModule(bool bUseEnumObject); diff --git a/comenv/mainrun.cpp b/comenv/mainrun.cpp index d44e58e6456237bb484a1b0af766c3f670e1092a..8a625ab680070ee9b4a4b4aceb94b934f2017f07 100644 --- a/comenv/mainrun.cpp +++ b/comenv/mainrun.cpp @@ -30,12 +30,12 @@ CMainRun::~CMainRun(void) Uninit(); } -std_method_impl CMainRun::init_class(IModuleBase* prot, IModuleBase* punkOuter) +std_method_impl CMainRun::init_class(IBase* prot, IBase* punkOuter) { m_pRot = prot; retrtpv(m_pRot, E_FAIL); - RFAILED(m_pRot->GetObject(CLSID_CObjectLoader, re_uuidof(IObjectLoader), (IModuleBase**)&m_pObjLoader)); + RFAILED(m_pRot->GetObject(CLSID_CObjectLoader, _uuidof(IObjectLoader), (IBase**)&m_pObjLoader)); retrtpv(m_pObjLoader, E_FAIL); s_pRsSrv = this; @@ -103,7 +103,7 @@ std_method_impl CMainRun::NotifyExit(bool* bExit) } _lComPtr pExit; - RFAILED(m_pRot->GetObject(m_clsMainPlugin, re_uuidof(IExit), (IModuleBase**)&pExit)); + RFAILED(m_pRot->GetObject(m_clsMainPlugin, _uuidof(IExit), (IBase**)&pExit)); retrtpv(pExit, E_INVALIDARG); return pExit->NotifyExit(bExit); @@ -154,13 +154,13 @@ HRESULT CMainRun::CheckCommandLine() HRESULT CMainRun::CreatePlugin(const CLSID& rpid) { - _lComPtr pUnknown; - HRESULT hr = CreateRotPlugin(rpid, (IModuleBase **)&pUnknown); + _lComPtr pUnknown; + HRESULT hr = CreateRotPlugin(rpid, (IBase **)&pUnknown); if(FAILED(hr)) { return hr; } - _lComPtr pPlugin(pUnknown); + _lComPtr pPlugin(pUnknown); if(pPlugin) { @@ -227,10 +227,10 @@ HRESULT CMainRun::StartOrStopPlugins(bool bStart) for(int i = nStart; i < nSize && i >= 0; i += nStep) { - _lComPtr pUnknown; - RFAILED(m_pRot->GetObject(m_startList[i].clsId, re_uuidof(IModuleBase), (IModuleBase**)&pUnknown)); + _lComPtr pUnknown; + RFAILED(m_pRot->GetObject(m_startList[i].clsId, _uuidof(IBase), (IBase**)&pUnknown)); - _lComPtr pPluginRun(pUnknown); + _lComPtr pPluginRun(pUnknown); if(!pPluginRun) { return E_FAIL; @@ -270,10 +270,10 @@ HRESULT CMainRun::UninitPlugins() for(int i = nStart; i < nSize && i >= 0; i += nStep) { - _lComPtr pUnknown; - RFAILED(m_pRot->GetObject(m_initList[i], re_uuidof(IModuleBase), (IModuleBase**)&pUnknown)); + _lComPtr pUnknown; + RFAILED(m_pRot->GetObject(m_initList[i], _uuidof(IBase), (IBase**)&pUnknown)); - _lComPtr pPlugin(pUnknown); + _lComPtr pPlugin(pUnknown); if(pPlugin) { pPlugin->Uninit(); @@ -283,17 +283,17 @@ HRESULT CMainRun::UninitPlugins() return S_OK; } -HRESULT CMainRun::CreateRotPlugin(const CLSID& rpid, IModuleBase **ppunk) +HRESULT CMainRun::CreateRotPlugin(const CLSID& rpid, IBase **ppunk) { retrtpv(rpid != GUID_NULL, E_FAIL); retrtpv(m_pRot, E_FAIL); - //HRESULT hr = m_pRot->GetObject(rpid, re_uuidof(IModuleBase), ppunk); + //HRESULT hr = m_pRot->GetObject(rpid, _uuidof(IBase), ppunk); //if(SUCCEEDED(hr)) // return hr; retrtpv(m_pObjLoader, E_FAIL); - RFAILED(m_pObjLoader->CreateInstance(m_pRot, rpid, NULL, re_uuidof(IModuleBase), (void**)ppunk)); + RFAILED(m_pObjLoader->CreateInstance(m_pRot, rpid, NULL, _uuidof(IBase), (void**)ppunk)); retrtpv(*ppunk, E_FAIL); diff --git a/comenv/mainrun.h b/comenv/mainrun.h index afe429255b6a9ae8b90b960217b6bd6ab08bb699..a35b085ebf0b002d53a01be0218a40caf84b83e3 100644 --- a/comenv/mainrun.h +++ b/comenv/mainrun.h @@ -52,7 +52,7 @@ public: UNKNOWN_IMP4_(IObjectRun, IExit, IServerInfo,IPluginObjectMgr); - std_method(init_class)(IModuleBase* prot, IModuleBase* punkOuter); + std_method(init_class)(IBase* prot, IBase* punkOuter); std_method(Init)(HINSTANCE hInstance , LPCTSTR lpCfgXMLName @@ -174,7 +174,7 @@ private: HRESULT StartOrStopPlugins(bool bStart); HRESULT UninitPlugins(); HRESULT CreatePlugin(const CLSID& rpid); - HRESULT CreateRotPlugin(const CLSID& rpid, IModuleBase **ppunk); + HRESULT CreateRotPlugin(const CLSID& rpid, IBase **ppunk); HRESULT DestroyRotPlugin(const CLSID& rpid); }; #endif \ No newline at end of file diff --git a/comenv/objectloader.cpp b/comenv/objectloader.cpp index 7b630598c7fad93058049dfc254bfe6910394ced..26ccc24a5e6835f84ccd14aa00844451091b1dce 100644 --- a/comenv/objectloader.cpp +++ b/comenv/objectloader.cpp @@ -10,7 +10,7 @@ CObjectLoader::~CObjectLoader(void) { } -std_method_impl CObjectLoader::init_class(IModuleBase* /*prot*/, IModuleBase *punkOuter) +std_method_impl CObjectLoader::init_class(IBase* /*prot*/, IBase *punkOuter) { retrtpv(!punkOuter, E_INVALIDARG); //init_class_map(g_mapBootClass, g_mapBootClass + sizeof(g_mapBootClass)/sizeof(g_mapBootClass[0])); @@ -53,7 +53,7 @@ std_method_impl CObjectLoader::Register(const CLSID& rclsid, LPCTSTR filename, L return S_OK; } -std_method_impl CObjectLoader::CreateInstance(IModuleBase *prot,const CLSID& rclsid, IModuleBase *punkOuter, +std_method_impl CObjectLoader::CreateInstance(IBase *prot,const CLSID& rclsid, IBase *punkOuter, const IID& riid, void **ppv) { INNER_LOCK lock(&m_CrtSection); @@ -68,7 +68,7 @@ std_method_impl CObjectLoader::CreateInstance(IModuleBase *prot,const CLSID& rcl retrtpv(it->second.pfnGetClsObj, E_UNEXPECTED); _lComPtr pfac; - RFAILED(it->second.pfnGetClsObj(rclsid, re_uuidof(IComObjectFrameworkClassFactory), (void**)&pfac)); + RFAILED(it->second.pfnGetClsObj(rclsid, _uuidof(IComObjectFrameworkClassFactory), (void**)&pfac)); return pfac->CreateInstance(prot, punkOuter, riid, ppv); } diff --git a/comenv/objectloader.h b/comenv/objectloader.h index fa7e15781c7b807ec69ba1ad556d42568bec84c8..84f6216497095076a906289b00925b0762b7a196 100644 --- a/comenv/objectloader.h +++ b/comenv/objectloader.h @@ -15,9 +15,9 @@ public: UNKNOWN_IMP4_(IObjectLoaderEx, IObjectLoader, IOLManagerEx, IOLManager); - std_method_impl init_class(IModuleBase* prot, IModuleBase* punkOuter); + std_method_impl init_class(IBase* prot, IBase* punkOuter); - std_method(CreateInstance)(IModuleBase* prot, const CLSID& rclsid, IModuleBase *punkOuter, const IID& riid, void **ppv); + std_method(CreateInstance)(IBase* prot, const CLSID& rclsid, IBase *punkOuter, const IID& riid, void **ppv); std_method_(LPCSTR, ProgIDFromCLSID)(REFCLSID clsid); std_method_(CLSID, CLSIDFromProgID)(LPCSTR lpProgId); diff --git a/comenv/rot.cpp b/comenv/rot.cpp index 29ea5d274e744b1b350f66bb4244218b4dbce89e..2362801ac647f801e9aeeaf8549f9a2fd2875da8 100644 --- a/comenv/rot.cpp +++ b/comenv/rot.cpp @@ -9,13 +9,13 @@ CRot::~CRot(void) { } -std_method_impl CRot::init_class(IModuleBase *prot, IModuleBase *punkOuter) +std_method_impl CRot::init_class(IBase *prot, IBase *punkOuter) { return S_OK; } -std_method_impl CRot::Register(const GUID& rpid, IModuleBase *punk) +std_method_impl CRot::Register(const GUID& rpid, IBase *punk) { retrtpv(S_OK != IsRunning(rpid), MK_S_MONIKERALREADYREGISTERED); @@ -39,7 +39,7 @@ std_method_impl CRot::IsRunning(const GUID& rpid) return m_map.end() != m_map.find(rpid) ? S_OK : S_FALSE; } -std_method_impl CRot::GetObject(const GUID& rpid, const IID iid, IModuleBase **ppunk) +std_method_impl CRot::GetObject(const GUID& rpid, const IID iid, IBase **ppunk) { OBJMAP::iterator it = m_map.find(rpid); retrtpv(m_map.end() != it, E_INVALIDARG); @@ -85,7 +85,7 @@ std_method_type_impl(LPCSTR) CRot::ProgIDFromCLSID(REFCLSID clsid) { _lComPtr pObjLoader; - retrtpv(SUCCEEDED(GetObject(CLSID_CObjectLoader, re_uuidof(IObjectLoaderEx), (IModuleBase**)&pObjLoader)),""); + retrtpv(SUCCEEDED(GetObject(CLSID_CObjectLoader, _uuidof(IObjectLoaderEx), (IBase**)&pObjLoader)),""); retrtpv(pObjLoader, ""); return pObjLoader->ProgIDFromCLSID(clsid); @@ -95,7 +95,7 @@ std_method_type_impl(CLSID) CRot::CLSIDFromProgID(LPCSTR lpProgId) { _lComPtr pObjLoader; - retrtpv(SUCCEEDED(GetObject(CLSID_CObjectLoader, re_uuidof(IObjectLoaderEx), (IModuleBase**)&pObjLoader)), GUID_NULL); + retrtpv(SUCCEEDED(GetObject(CLSID_CObjectLoader, _uuidof(IObjectLoaderEx), (IBase**)&pObjLoader)), GUID_NULL); retrtpv(pObjLoader, GUID_NULL); return pObjLoader->CLSIDFromProgID(lpProgId); diff --git a/comenv/rot.h b/comenv/rot.h index 1a2aef1e8aa7bfe2d7f6238d6ec4652163ed1b71..18e7def1723ced0c1cad8011babe1912f9de0998 100644 --- a/comenv/rot.h +++ b/comenv/rot.h @@ -12,14 +12,14 @@ public: UNKNOWN_IMP2(IComRunningObjectTableEx, IComRunningObjectTable); - std_method_impl init_class(IModuleBase *prot, IModuleBase *punkOuter); + std_method_impl init_class(IBase *prot, IBase *punkOuter); public: // ISrvRunningObjectTable: - std_method(Register)(const GUID& rpid, IModuleBase *punk); + std_method(Register)(const GUID& rpid, IBase *punk); std_method(Revoke)(const GUID& rpid); std_method(IsRunning)(const GUID& rpid); - std_method(GetObject)(const GUID& rpid, const IID iid, IModuleBase **ppunk); + std_method(GetObject)(const GUID& rpid, const IID iid, IBase **ppunk); std_method(RevokeAll)(); std_method(RegisterCreateInterface)(const GUID& rpid, const CLSID& clsid,const IID& iid); @@ -37,7 +37,7 @@ private: DWORD dwInitMark; CLSID clsid; IID iid; - _lComPtr m_ptr; + _lComPtr m_ptr; } RUNNINGTABLEITEM; diff --git a/comenv/srv.cpp b/comenv/srv.cpp index 14e9d46a2fdf77b066b07c89ed35ff7e6ccb2b00..967731349f166de619a0ac60eaff29187fe0a874 100644 --- a/comenv/srv.cpp +++ b/comenv/srv.cpp @@ -19,7 +19,7 @@ CSrv::~CSrv(void) { } -std_method_impl CSrv::init_class(IModuleBase* prot, IModuleBase* punkOuter) +std_method_impl CSrv::init_class(IBase* prot, IBase* punkOuter) { return S_OK; } diff --git a/comenv/srv.h b/comenv/srv.h index c54cf0423cb5da30b1a76aa857e995cc14708b0f..4e08f79bfc5ac1ad8b32a66cd651378fade83146 100644 --- a/comenv/srv.h +++ b/comenv/srv.h @@ -4,7 +4,7 @@ // {5D37C04C-8F58-4d47-94C8-B94153399473} -MD_DEFINE_GUID(CLSID_SRV,0x5d37c04c, 0x8f58, 0x4d47, 0x94, 0xc8, 0xb9, 0x41, 0x53, 0x39, 0x94, 0x73); +_DEFINE_GUID(CLSID_SRV,0x5d37c04c, 0x8f58, 0x4d47, 0x94, 0xc8, 0xb9, 0x41, 0x53, 0x39, 0x94, 0x73); #ifdef _MSC_VER @@ -63,8 +63,8 @@ private: -class CSrv : public IMdPlugin, - public IMdPluginRun, +class CSrv : public IPlugin, + public IPluginRun, public IExit, public CUnknownImp { @@ -72,8 +72,8 @@ public: CSrv(void); ~CSrv(void); - UNKNOWN_IMP3_(IMdPlugin, IMdPluginRun, IExit); - std_method_impl init_class(IModuleBase* prot, IModuleBase* punkOuter); + UNKNOWN_IMP3_(IPlugin, IPluginRun, IExit); + std_method_impl init_class(IBase* prot, IBase* punkOuter); std_method(Init)(void*); std_method(Uninit)(); diff --git a/extensions/include/adapter/iadapter.h b/extensions/include/adapter/iadapter.h index 1c5cbed15d058ac0699403d0d91fbaa0fac125ed..2ec0ed9ced5d63aa542658c393d92780341fb46e 100644 --- a/extensions/include/adapter/iadapter.h +++ b/extensions/include/adapter/iadapter.h @@ -1,7 +1,7 @@ #ifndef _IADAPTER_H_ #define _IADAPTER_H_ -interface IAdapter : public IModuleBase +interface IAdapter : public IBase { std_method(RunFile)(const char* file) = 0; }; @@ -13,17 +13,17 @@ enum AdaptersType{ AT_PY = 3 }; -interface IAdapters : public IModuleBase +interface IAdapters : public IBase { std_method(RegisterFunc)(const char* file) = 0; std_method(RegisterVariable)(const char* file) = 0; std_method(CallFunc)(const char* file) = 0; }; -MD_DEFINE_IID(IAdapters, "{8205BA0A-30D5-4C55-8719-C68B5ADEE243}"); +_DEFINE_IID(IAdapters, "{8205BA0A-30D5-4C55-8719-C68B5ADEE243}"); // {74785A7F-55A5-4DE4-9030-059DF97C7B70} -MD_DEFINE_GUID(CLSID_Adapters, +_DEFINE_GUID(CLSID_Adapters, 0x74785a7f, 0x55a5, 0x4de4, 0x90, 0x30, 0x5, 0x9d, 0xf9, 0x7c, 0x7b, 0x70); diff --git a/extensions/include/adapter/ijavascript.h b/extensions/include/adapter/ijavascript.h index 42dab151a0508596b1f979de57f720a40d8f8a7d..2f99c6ac9ee307cf030015ed8ec9d43d78c0e1ef 100644 --- a/extensions/include/adapter/ijavascript.h +++ b/extensions/include/adapter/ijavascript.h @@ -7,11 +7,11 @@ interface IAdapterJavaScript : public IAdapter { }; -MD_DEFINE_IID(IAdapterJavaScript, "{D4FD08F2-BCE4-4A75-A9BF-266409DC4A80}"); +_DEFINE_IID(IAdapterJavaScript, "{D4FD08F2-BCE4-4A75-A9BF-266409DC4A80}"); // {A484C623-C2A8-4CC0-BBFB-8582687B763F} -MD_DEFINE_GUID(CLSID_AdapaterJavaScript, +_DEFINE_GUID(CLSID_AdapaterJavaScript, 0xa484c623, 0xc2a8, 0x4cc0, 0xbb, 0xfb, 0x85, 0x82, 0x68, 0x7b, 0x76, 0x3f); #endif \ No newline at end of file diff --git a/extensions/include/adapter/ilua.h b/extensions/include/adapter/ilua.h index 24d8c3ccb37404104f8980f1d2d95218d7a02058..d6c69f101f520e5955c8fb3958f7f3b62a08dc6a 100644 --- a/extensions/include/adapter/ilua.h +++ b/extensions/include/adapter/ilua.h @@ -7,10 +7,10 @@ interface IAdapterLua : public IAdapter { }; -MD_DEFINE_IID(IAdapterLua, "{DE45CF04-9710-4C78-BC28-1F9FA49F558A}"); +_DEFINE_IID(IAdapterLua, "{DE45CF04-9710-4C78-BC28-1F9FA49F558A}"); // {CDCADFED-0CDA-41B9-B1BA-5FADD5EF2D16} -MD_DEFINE_GUID(CLSID_AdapaterLua, +_DEFINE_GUID(CLSID_AdapaterLua, 0xcdcadfed, 0xcda, 0x41b9, 0xb1, 0xba, 0x5f, 0xad, 0xd5, 0xef, 0x2d, 0x16); #endif diff --git a/extensions/include/adapter/ipy.h b/extensions/include/adapter/ipy.h index b17d4f203faca4b3416ae7ac292f4e1bd6c67873..5d5b7714c0ef96f92f27c18229c8627c2d671bec 100644 --- a/extensions/include/adapter/ipy.h +++ b/extensions/include/adapter/ipy.h @@ -7,10 +7,10 @@ interface IAdapterPy : public IAdapter { }; -MD_DEFINE_IID(IAdapterPy, "{A7D46745-2E87-4143-B88A-AAD2AF1D9FE0}"); +_DEFINE_IID(IAdapterPy, "{A7D46745-2E87-4143-B88A-AAD2AF1D9FE0}"); // {69345794-5989-4FEB-AD67-0C3B4FFBA61C} -MD_DEFINE_GUID(CLSID_AdapterPy, +_DEFINE_GUID(CLSID_AdapterPy, 0x69345794, 0x5989, 0x4feb, 0xad, 0x67, 0xc, 0x3b, 0x4f, 0xfb, 0xa6, 0x1c); diff --git a/extensions/include/data/iinfoanalsis.h b/extensions/include/data/iinfoanalsis.h index a7465460b67e01bb1d63ac9a93205cbef76edb98..c478f535c9733002633c0bec6e3ea81a75ec55df 100644 --- a/extensions/include/data/iinfoanalsis.h +++ b/extensions/include/data/iinfoanalsis.h @@ -4,7 +4,7 @@ #pragma pack(1) typedef LPVOID InfoNode; -interface InfoRoot : public IModuleBase +interface InfoRoot : public IBase { std_method(LoadData)(char* data) = 0; std_method(GetRootNode)(InfoNode* Node) = 0; @@ -16,34 +16,34 @@ interface InfoRoot : public IModuleBase std_method(GetNodeIndexNode)(InfoNode Node, unsigned long ulIndex, InfoNode* ChildNode) = 0; }; #pragma pack() -MD_DEFINE_IID(InfoRoot, "{0771D5F4-EBD0-4AB8-B8A1-2D0F49842C01}"); +_DEFINE_IID(InfoRoot, "{0771D5F4-EBD0-4AB8-B8A1-2D0F49842C01}"); #pragma pack(1) -interface IInfoAnalysis : public IModuleBase +interface IInfoAnalysis : public IBase { - std_method(NewObject)(const char* data, IModuleBase** Root) = 0; - std_method(NewLoadFileObject)(const TCHAR* filepath, IModuleBase** Root) = 0; - std_method(DelObject)(IModuleBase* Root) = 0; + std_method(NewObject)(const char* data, IBase** Root) = 0; + std_method(NewLoadFileObject)(const TCHAR* filepath, IBase** Root) = 0; + std_method(DelObject)(IBase* Root) = 0; }; #pragma pack() -MD_DEFINE_IID(IInfoAnalysis, "{179AFDE4-3C51-4c5a-86B0-C7B61092E106}"); +_DEFINE_IID(IInfoAnalysis, "{179AFDE4-3C51-4c5a-86B0-C7B61092E106}"); #pragma pack(1) -interface IDataJsonToXML : public IModuleBase +interface IDataJsonToXML : public IBase { std_method(JsonToXML)(const char* input, char* output, unsigned long ulen) = 0; std_method(XMLToJson)(const char* input, char* output, unsigned long ulen) = 0; }; #pragma pack() -MD_DEFINE_IID(IDataJsonToXML, "{CF1B54BF-144E-442C-8BA4-60C7CAE0F193}"); +_DEFINE_IID(IDataJsonToXML, "{CF1B54BF-144E-442C-8BA4-60C7CAE0F193}"); // {E2C3154C-AFC7-4875-8BCC-CB116CA0CF45} -MD_DEFINE_GUID(CLSID_InfoAnalysis, +_DEFINE_GUID(CLSID_InfoAnalysis, 0xe2c3154c, 0xafc7, 0x4875, 0x8b, 0xcc, 0xcb, 0x11, 0x6c, 0xa0, 0xcf, 0x45); diff --git a/extensions/include/data/iyangcontext.h b/extensions/include/data/iyangcontext.h index 4066c5decefdac647b29b1f529ad1180bd2dbb04..e8febbeba57bdc071690b2b57ba0e1f0b368f1d6 100644 --- a/extensions/include/data/iyangcontext.h +++ b/extensions/include/data/iyangcontext.h @@ -3,7 +3,7 @@ -interface IYangModuleInfo : public IModuleBase +interface IYangModuleInfo : public IBase { std_method_(const char*,GetName)() = 0; std_method_(const char*,GetVersion)() = 0; @@ -15,22 +15,22 @@ interface IYangModuleInfo : public IModuleBase std_method_(const char*,GetOrg)() = 0; std_method_(const char*,GetContact)() = 0; }; -MD_DEFINE_IID(IYangModuleInfo, "{DAE6E1A0-BDCF-4940-838D-0FB844CA11C3}"); +_DEFINE_IID(IYangModuleInfo, "{DAE6E1A0-BDCF-4940-838D-0FB844CA11C3}"); -interface IYangContext : public IModuleBase +interface IYangContext : public IBase { std_method(InitYangFiles)(const char* files) = 0; - std_method(LoadModule)(const char* file,IModuleBase** pYangFile) = 0; - std_method(ParseModule)(const char* file,IModuleBase** pYangFile) = 0; + std_method(LoadModule)(const char* file,IBase** pYangFile) = 0; + std_method(ParseModule)(const char* file,IBase** pYangFile) = 0; std_method_(const char* const*,GetSearchdirs)() = 0; }; -MD_DEFINE_IID(IYangContext, "{6CDEEC0C-970D-4559-BA2E-9F4C460FFEC1}"); +_DEFINE_IID(IYangContext, "{6CDEEC0C-970D-4559-BA2E-9F4C460FFEC1}"); // {1EFECF2D-B556-4EDB-9B2B-9CAC17AAC4F7} -MD_DEFINE_GUID(CLSID_YangContext, +_DEFINE_GUID(CLSID_YangContext, 0x1efecf2d, 0xb556, 0x4edb, 0x9b, 0x2b, 0x9c, 0xac, 0x17, 0xaa, 0xc4, 0xf7); diff --git a/extensions/include/io/iasynio.h b/extensions/include/io/iasynio.h index 1c48146035cda94846f78c10c416ab261330a6bf..cbaa92470770917747aafa3249424c53527c9820 100644 --- a/extensions/include/io/iasynio.h +++ b/extensions/include/io/iasynio.h @@ -2,114 +2,29 @@ #define _ASYNIO_H_ -interface IReadFile : public IModuleBase -{ - std_method(LoadFile)(const TCHAR* pszLoadFile, - unsigned long ulwDesiredAccess, - unsigned long ulShareMode, - unsigned long ulCreationDisposition, - unsigned long ulFlagsAndAttributes) = 0; - std_method(CloseFile)() = 0; - std_method_(byint64, GetFileSize)() = 0; - std_method(ReadBuffer)(char* szBuffer, byint64 ulReadFileLen, byint64* ulReadSize) = 0; - std_method(AsynReadBuffer)(const char* szNodeName,char* szNodeInfo) = 0; -}; +#include +#include -MD_DEFINE_IID(IReadFile, "{9DF32AD9-2C96-446C-B4D4-EC88AFF8A5F9}"); +#include +#include +#include -interface IWriteFile : public IModuleBase -{ - - std_method(LoadFile)(const char* pszLoadFile, - unsigned long ulwDesiredAccess, - unsigned long ulShareMode, - unsigned long ulCreationDisposition, - unsigned long ulFlagsAndAttributes) = 0; - std_method(CloseFile)() = 0; - std_method(GetFileSize)(unsigned long* ulReadSize) = 0; - std_method(WriteBuffer)(const char* szNodeName,char* szNodeInfo) = 0; - std_method(AsynWriteBuffer)(const char* szNodeName,char* szNodeInfo) = 0; -}; -MD_DEFINE_IID(IWriteFile, "{6F7C433A-D7C5-4EFB-A525-701A675D7382}"); - - -interface ISocket : public IModuleBase +interface IAsynIo : public IBase { - std_method(CreateSocket)() = 0; - std_method(CloseSocket)() = 0; - std_method_(os_sock_t, GetSocket)() = 0; - std_method_(ssize_t, Send)(const char* buf, size_t len, int flags) = 0; - std_method_(ssize_t, Recv)(char* addr, size_t len, int flags) = 0; + std_method(CreateReadFile)(IBase** pReadFile) = 0; + std_method(CreateWriteFile)(IBase** pWriteFile) = 0; + std_method(CreateAsyncTcpSocket)(IBase** pAsynTcpSocket) = 0; + std_method(CreateTcpSocket)(IBase** pTcpSocket) = 0; + std_method(CreateAsyncUdpSocket)(IBase** pAsynUdpSocket) = 0; + std_method(CreateUdpSocket)(IBase** pUdpSocket) = 0; + std_method(DeleteIo)(IBase* pAsynIo) = 0; }; - -//#define SO_SNDBUF 0x1001 // send buffer size -//#define SO_RCVBUF 0x1002 // receive buffer size -//#define SO_SNDLOWAT 0x1003 // send low-water mark -//#define SO_RCVLOWAT 0x1004 // receive low-water mark -//#define SO_SNDTIMEO 0x1005 // send timeout -//#define SO_RCVTIMEO 0x1006 // receive timeout - -interface ITcpSocket : public ISocket -{ - std_method(Bind)(const char* addr, unsigned int uport) = 0; - std_method_(os_sock_t, BindAccept)(const char* addr, unsigned int uport, int n) = 0; - std_method(SetReuseAddr)(bool bstart) = 0; - std_method(SetNoDelay)(bool bstart) = 0; - std_method(SetLinger)(bool bstart) = 0; - std_method(SetKeepalive)(bool bstart) = 0; - std_method(SetCork)(bool bstart) = 0; - std_method(SetNoSigPipe)(bool bstart) = 0; - -}; -MD_DEFINE_IID(ITcpSocket, "{6F7C433A-D7C5-4EFB-A525-701A675D7388}"); - -interface IAsyncTcpSocket : public ITcpSocket -{ - std_method(SetNonblock)(bool bstart) = 0; - std_method(SendBufLen)(int size) = 0; - std_method(RecvBufLen)(int size) = 0; - std_method(SendTime)(int sec) = 0; - std_method(RecvTime)(int sec) = 0; - std_method(SendLoWat)(int size) = 0; - std_method(RecvLoWat)(int size) = 0; - -}; - -MD_DEFINE_IID(IAsyncTcpSocket, "{6F7C433A-D7C5-4EFB-A525-701A675D7389}"); - - -interface IUdpSocket : public ISocket -{ - -}; -MD_DEFINE_IID(IUdpSocket, "{011A712D-1CD0-4F01-B365-35CB79AABBC6}"); - -interface IAsyncUdpSocket : public ISocket -{ - -}; -MD_DEFINE_IID(IAsyncUdpSocket, "{AD708F28-58CB-46CE-A672-A16662944D8A}"); - - - -interface IAsynIo : public IModuleBase -{ - std_method(CreateReadFile)(IReadFile** pReadFile) = 0; - std_method(CreateWriteFile)(IWriteFile** pWriteFile) = 0; - std_method(CreateAsyncTcpSocket)(IAsyncTcpSocket** pAsynTcpSocket) = 0; - std_method(CreateTcpSocket)(ITcpSocket** pTcpSocket) = 0; - std_method(CreateAsyncUdpSocket)(IAsyncUdpSocket** pAsynUdpSocket) = 0; - std_method(CreateUdpSocket)(IUdpSocket** pUdpSocket) = 0; - std_method(DeleteIo)(IModuleBase* pAsynIo) = 0; -}; -MD_DEFINE_IID(IAsynIo, "{91559897-31F2-46C1-85AB-1ED97D58EE7B}"); - - +_DEFINE_IID(IAsynIo, "{91559897-31F2-46C1-85AB-1ED97D58EE7B}"); // {B6DDB9B0-186F-4199-A0B3-7BA5026F5888} -MD_DEFINE_GUID(CLSID_IAsynIo, +_DEFINE_GUID(CLSID_IAsynIo, 0xb6ddb9b0, 0x186f, 0x4199, 0xa0, 0xb3, 0x7b, 0xa5, 0x2, 0x6f, 0x58, 0x88); diff --git a/extensions/include/io/ievent.h b/extensions/include/io/ievent.h new file mode 100644 index 0000000000000000000000000000000000000000..98e392f41fb19d830d1b93ea7a60a99c0f460923 --- /dev/null +++ b/extensions/include/io/ievent.h @@ -0,0 +1,45 @@ +#ifndef _ASYN_EVENTBASE_H_ +#define _ASYN_EVENTBASE_H_ + + +#include + + +interface IMessageEvents : public IBase +{ + std_method(OnMessage)(ULONG lMessageId, ULONG lParam1, ULONG lParam2) = 0; + std_method(OnDeleteMessage)(ULONG lMessageId, ULONG lParam1, ULONG lParam2) = 0; +}; +_DEFINE_IID(IMessageEvents, "{004BB07B-5B97-4BA3-A16B-4113F00E6F85}"); + + +interface IEventBase : public IBase +{ + std_method(AttachMessageEvents)(IMessageEvents *pEvents) = 0; + std_method(DetachMessageEvents)(IMessageEvents *pEvents) = 0; + std_method(SendMessage)(IMessageEvents *pEvents, + ULONG lMessageId, + ULONG lParam1, + ULONG lParam2) = 0; + std_method(PostMessage)(IMessageEvents *pEvents, + ULONG lMessageId, + ULONG lParam1, + ULONG lParam2) = 0; + std_method(AddTimer)(ITimerEvents *pEvents, + ULONG lTimerId, + ULONG lMilliSecond, + BOOL bCycled) = 0; + + std_method(DelTimer)(ITimerEvents *pEvents,ULONG lTimerId) = 0; + std_method(ClearTimer)(ITimerEvents *pEvents) = 0; + std_method(CreateAsynIoOperation)(IIoOperation **ppOperation) = 0; + std_method(PostAsynIoOperation)(IIoOperation *pOperation) = 0; + + +}; +_DEFINE_IID(IEventBase, "{1351D756-958E-4DE5-86C6-9280AC49E672}"); +// {F170A724-AACA-4603-BB1C-0A8EAF1C3322} +_DEFINE_GUID(CLSID_EventBase, + 0xf170a724, 0xaaca, 0x4603, 0xbb, 0x1c, 0xa, 0x8e, 0xaf, 0x1c, 0x33, 0x22); + +#endif \ No newline at end of file diff --git a/extensions/include/io/ifile.h b/extensions/include/io/ifile.h new file mode 100644 index 0000000000000000000000000000000000000000..923d5211bec3a50890046ca04d38ff06068fc9f3 --- /dev/null +++ b/extensions/include/io/ifile.h @@ -0,0 +1,36 @@ +#ifndef _ASYN_FILE_H_ +#define _ASYN_FILE_H_ + +interface IReadFile : public IBase +{ + std_method(LoadFile)(const TCHAR* pszLoadFile, + unsigned long ulwDesiredAccess, + unsigned long ulShareMode, + unsigned long ulCreationDisposition, + unsigned long ulFlagsAndAttributes) = 0; + std_method(CloseFile)() = 0; + std_method_(os_int64, GetFileSize)() = 0; + std_method(ReadBuffer)(char* szBuffer, os_int64 ulReadFileLen, os_int64* ulReadSize) = 0; + std_method(AsynReadBuffer)(const char* szNodeName,char* szNodeInfo) = 0; +}; + +_DEFINE_IID(IReadFile, "{9DF32AD9-2C96-446C-B4D4-EC88AFF8A5F9}"); + + +interface IWriteFile : public IBase +{ + + std_method(LoadFile)(const char* pszLoadFile, + unsigned long ulwDesiredAccess, + unsigned long ulShareMode, + unsigned long ulCreationDisposition, + unsigned long ulFlagsAndAttributes) = 0; + std_method(CloseFile)() = 0; + std_method(GetFileSize)(unsigned long* ulReadSize) = 0; + std_method(WriteBuffer)(const char* szNodeName,char* szNodeInfo) = 0; + std_method(AsynWriteBuffer)(const char* szNodeName,char* szNodeInfo) = 0; +}; +_DEFINE_IID(IWriteFile, "{6F7C433A-D7C5-4EFB-A525-701A675D7382}"); + + +#endif \ No newline at end of file diff --git a/extensions/include/io/iiodevice.h b/extensions/include/io/iiodevice.h new file mode 100644 index 0000000000000000000000000000000000000000..69b80c9f1e331cf74e835ea71bf3ebc6818dd14e --- /dev/null +++ b/extensions/include/io/iiodevice.h @@ -0,0 +1,16 @@ +#ifndef _ASYN_DEVICE_H_ +#define _ASYN_DEVICE_H_ + +interface IIoDevice : public IBase +{ + std_method(ReadIo)(IIoOperation* pOperation) = 0; + std_method(WriteIo)(IIoOperation* pOperation) = 0; + std_method(ReadAllIo)(IIoOperation* pOperation) = 0; + std_method(WriteAllIo)(IIoOperation* pOperation) = 0; + std_method(CloseIo)() = 0; + std_method(OpenIo)() = 0; +}; + +_DEFINE_IID(IIoDevice, "{0E894943-2B92-40F5-B4D4-7D960DF6D986}"); + +#endif \ No newline at end of file diff --git a/extensions/include/io/ioperation.h b/extensions/include/io/ioperation.h new file mode 100644 index 0000000000000000000000000000000000000000..ab44b3ac08858033b4501091a33d906279937e44 --- /dev/null +++ b/extensions/include/io/ioperation.h @@ -0,0 +1,42 @@ +#ifndef _ASYN_OPERATION_H_ +#define _ASYN_OPERATION_H_ + + +typedef ULONG ERROR_CODE; +typedef BYTE *BUFFER_PTR; +typedef ULONG BUFFER_SIZE; + +interface IIoOperationEvents; + +interface IIoOperation : public IBase +{ + std_method(Bind)(IIoOperationEvents* pEvent) = 0; + std_method(SetId)(ULONG lId) = 0; + std_method(GetId)(ULONG *pId) = 0; + std_method(SetResult)(ERROR_CODE lErrorCode, + ULONG lTransferedBytes) = 0; + std_method(GetResult)(ERROR_CODE *pErrorCode, + ULONG *pTransferedBytes) = 0; + std_method(AllocBuffer)(ULONG lBufferSize) = 0; + std_method(GetBuffer)(BUFFER_PTR *ppBuffer, + BUFFER_SIZE *pBufferSize) = 0; + std_method(ReleaseBuffer)() = 0; + std_method(SetIoParam)(ULONG lIoStartPos,ULONG lIoExpectBytes) = 0; + std_method(GetIoParam)(ULONG* pIoStartPos,ULONG* pIoExpectBytes) = 0; + std_method(SetOperationPos)(ULONGLONG lOperationPos) = 0; + std_method(GetOperationPos)(ULONGLONG* pOperationPos) = 0; + std_method(SetResultInterface)(IBase* lOperationPos) = 0; + std_method(GetResultInterface)(IBase** pOperationPos) = 0; + std_method(Cancel)() = 0; + +}; +_DEFINE_IID(IIoOperation, "{D34BE927-B63E-4B0C-9BE7-D4E123A05B2B}"); + +interface IIoOperationEvents : public IBase +{ + std_method(OnOperationComplete)(IIoOperation *pOperation) = 0; +}; +_DEFINE_IID(IIoOperationEvents, "{2D2E1C66-AB07-430F-9C9A-AF9855AC7071}"); + + +#endif \ No newline at end of file diff --git a/extensions/include/io/isocket.h b/extensions/include/io/isocket.h new file mode 100644 index 0000000000000000000000000000000000000000..49e57891ed6ec0413afd8612cef7e52729d16ef4 --- /dev/null +++ b/extensions/include/io/isocket.h @@ -0,0 +1,58 @@ +#ifndef _ASYN_SOCKET_H_ +#define _ASYN_SOCKET_H_ + + + +interface ISocket : public IIoDevice +{ + std_method_(os_sock_t, GetSocket)() = 0; +}; +_DEFINE_IID(ISocket, "{B3F9D677-0489-4B9D-B2FB-E48F6B0E2E68}"); + + + +interface ITcpSocket : public ISocket +{ + std_method(Bind)(const char* addr, unsigned int uport) = 0; + std_method_(os_sock_t, BindAccept)(const char* addr, unsigned int uport, int n) = 0; + std_method(SetReuseAddr)(bool bstart) = 0; + std_method(SetNoDelay)(bool bstart) = 0; + std_method(SetLinger)(bool bstart) = 0; + std_method(SetKeepalive)(bool bstart) = 0; + std_method(SetCork)(bool bstart) = 0; + std_method(SetNoSigPipe)(bool bstart) = 0; +}; +_DEFINE_IID(ITcpSocket, "{6F7C433A-D7C5-4EFB-A525-701A675D7388}"); + +interface IAsyncTcpSocket : public ITcpSocket +{ + std_method(SetNonblock)(bool bstart) = 0; + std_method(SendBufLen)(int size) = 0; + std_method(RecvBufLen)(int size) = 0; + std_method(SendTime)(int sec) = 0; + std_method(RecvTime)(int sec) = 0; + std_method(SendLoWat)(int size) = 0; + std_method(RecvLoWat)(int size) = 0; + +}; + +_DEFINE_IID(IAsyncTcpSocket, "{6F7C433A-D7C5-4EFB-A525-701A675D7389}"); + + +interface IUdpSocket : public ISocket +{ + +}; +_DEFINE_IID(IUdpSocket, "{011A712D-1CD0-4F01-B365-35CB79AABBC6}"); + + + + +interface IAsyncUdpSocket : public ISocket +{ + +}; +_DEFINE_IID(IAsyncUdpSocket, "{AD708F28-58CB-46CE-A672-A16662944D8A}"); + + +#endif \ No newline at end of file diff --git a/extensions/include/io/itimer.h b/extensions/include/io/itimer.h new file mode 100644 index 0000000000000000000000000000000000000000..2db23819501e5486b1d2ab242575c53d2df6dcbc --- /dev/null +++ b/extensions/include/io/itimer.h @@ -0,0 +1,11 @@ +#ifndef _ASYN_TIMER_H_ +#define _ASYN_TIMER_H_ + +interface ITimerEvents : public IBase +{ + std_method(OnTimer)(ULONG lTimerID) = 0; +}; +_DEFINE_IID(ITimerEvents, "{240A3E28-8DC6-4AE4-AACA-A7FFCBC2D5C7}"); + + +#endif \ No newline at end of file diff --git a/extensions/include/mem/imempool.h b/extensions/include/mem/imempool.h index 1870fbbb8f1fad2b189b07553dc54aec08ac43be..d518d80ca122283bc598b07d8074bce8a2eb6fff 100644 --- a/extensions/include/mem/imempool.h +++ b/extensions/include/mem/imempool.h @@ -6,7 +6,7 @@ enum MemPoolType{ MEMPOOL_FILE = 2 }; -interface IMemPool: public IModuleBase +interface IMemPool: public IBase { std_method(MemPool)(MemPoolType type,const char* memfile) = 0; std_method_(void*, Memalloc)(size_t size) = 0; @@ -16,10 +16,10 @@ interface IMemPool: public IModuleBase std_method(MemPoolFree)() = 0; std_method(MemPoolRest)() = 0; }; -MD_DEFINE_IID(IMemPool, "{3B02F308-DBF0-45F2-8302-16E9C9C51FD2}"); +_DEFINE_IID(IMemPool, "{3B02F308-DBF0-45F2-8302-16E9C9C51FD2}"); // {D1C10177-9BA2-4586-AB8C-0867CAAA7EA1} -MD_DEFINE_GUID(CLSID_IMemPool, +_DEFINE_GUID(CLSID_IMemPool, 0xd1c10177, 0x9ba2, 0x4586, 0xab, 0x8c, 0x8, 0x67, 0xca, 0xaa, 0x7e, 0xa1); diff --git a/extensions/include/sshchannel/isschannel.h b/extensions/include/sshchannel/isschannel.h index f8fe739e6a5385f1a46aa7f73ac0879b1b51e42b..86a7c399312e02ee3f72dc19958825839f5015e6 100644 --- a/extensions/include/sshchannel/isschannel.h +++ b/extensions/include/sshchannel/isschannel.h @@ -3,30 +3,30 @@ typedef long sshid; -interface ISshChannel : public IModuleBase +interface ISshChannel : public IBase { std_method_(sshid, CreateSshChannel)() = 0; std_method(CloseChannel)(sshid id) = 0; std_method_(ssize_t, SendChannel)(sshid id,char* buf,size_t len) = 0; std_method_(ssize_t, RecvChannel)(sshid id,char* buf,size_t len) = 0; }; -MD_DEFINE_IID(ISshChannel, "{45BAC576-355D-4D08-8B86-0283BE3E7FBF}"); +_DEFINE_IID(ISshChannel, "{45BAC576-355D-4D08-8B86-0283BE3E7FBF}"); interface ISshCliObj : public ISshChannel { std_method(CreateConnectChannel)(sshid id,const char* adder,unsigned int uport) = 0; }; -MD_DEFINE_IID(ISshCliObj, "{D2F5C0A1-EAE9-4C6B-B9DF-5716935E930D}"); +_DEFINE_IID(ISshCliObj, "{D2F5C0A1-EAE9-4C6B-B9DF-5716935E930D}"); interface ISshSrvObj : public ISshChannel { std_method_(sshid, CreateAcceptChannel)(sshid id,const char* adder, unsigned int uport) = 0; }; -MD_DEFINE_IID(ISshSrvObj, "{520BB6DE-BD39-43D7-9452-983141E0C00F}"); +_DEFINE_IID(ISshSrvObj, "{520BB6DE-BD39-43D7-9452-983141E0C00F}"); // {4A27FA11-BEA7-46E8-9F32-EC0C9F6E1A9E} -MD_DEFINE_GUID(CLSID_SshChannel, +_DEFINE_GUID(CLSID_SshChannel, 0x4a27fa11, 0xbea7, 0x46e8, 0x9f, 0x32, 0xec, 0xc, 0x9f, 0x6e, 0x1a, 0x9e); #endif \ No newline at end of file diff --git a/include/dlcom/byid.hpp b/include/dlcom/byid.hpp index 244dde2ad2904a7f1486d4857fa1947fe0e1fa57..e581b7ff8785bb1be60dd38c9c162b3c0de0127b 100644 --- a/include/dlcom/byid.hpp +++ b/include/dlcom/byid.hpp @@ -24,14 +24,9 @@ public: #ifdef __GNUC__ - -#define re_uuidof(DerivedType) (__uuid_s::iid) -#define md_uuidof(iface) (__uuid_s::iid) - - +#define _uuidof(iface) (__uuid_s::iid) #else -#define re_uuidof(DerivedType) __uuidof(DerivedType) -#define md_uuidof(iface) __uuidof(iface) +#define _uuidof(iface) __uuidof(iface) #endif @@ -67,26 +62,26 @@ public: #ifdef __GNUC__ -#define MD_DEFINE_UUID(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \ +#define _DEFINE_UUID(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \ static const uuid_t name __attribute__ ((unused)) = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15} -#define MD_DEFINE_IID(iface, uuid_string) \ +#define _DEFINE_IID(iface, uuid_string) \ template<> GUID __attribute__((weak)) __uuid_s::iid = S2GUIDA(uuid_string); -#define MD_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ +#define _DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ EXTERN_C const GUID __attribute__((weak)) name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } //#define DEFINE_OLEGUID(name, l, w1, w2) DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46) #else -#define MD_DEFINE_UUID(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \ +#define _DEFINE_UUID(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \ static const uuid_t name = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}; -#define MD_DEFINE_IID(iface, uuid_string) struct __declspec(uuid(uuid_string)) iface +#define _DEFINE_IID(iface, uuid_string) struct __declspec(uuid(uuid_string)) iface -#define MD_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ +#define _DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ EXTERN_C const GUID DECLSPEC_SELECTANY name \ = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } @@ -95,7 +90,7 @@ public: #endif #ifndef GUID_NULL -MD_DEFINE_GUID(GUID_NULL, 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); +_DEFINE_GUID(GUID_NULL, 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); #endif diff --git a/include/dlcom/byunknown.hpp b/include/dlcom/byunknown.hpp index 661192f283164c2620baa9c28c1a589228eaecce..3217bcb766c3fb05d850bb06e77fe6d8beab57fb 100644 --- a/include/dlcom/byunknown.hpp +++ b/include/dlcom/byunknown.hpp @@ -81,17 +81,16 @@ typedef long HRESULT; #endif -#define IModuleBase ISupports #define IBase ISupports #define INULL ((ISupports*)0) interface ISupports { std_method(QueryInterface)(const IID & riid, void **ppv) = 0; - std_method_(ULONG, AddRef)() = 0; - std_method_(ULONG, Release)() = 0; + std_method_(ULONG, AddRef)() = 0; + std_method_(ULONG, Release)() = 0; }; -MD_DEFINE_IID(ISupports, "{00000000-0000-0000-C000-000000000046}"); +_DEFINE_IID(ISupports, "{00000000-0000-0000-C000-000000000046}"); interface IClassFactory__ : public ISupports @@ -99,7 +98,7 @@ interface IClassFactory__ : public ISupports std_method_(HRESULT, CreateInstance)(IBase *pUnkOuter, REFIID riid,void **ppvObject) = 0; std_method_(HRESULT, LockServer)(BOOL fLock) = 0; }; -MD_DEFINE_IID(IClassFactory__, "{00000001-0000-0000-C000-000000000046}"); +_DEFINE_IID(IClassFactory__, "{00000001-0000-0000-C000-000000000046}"); diff --git a/include/dlcom/comfactory.hpp b/include/dlcom/comfactory.hpp index cfa27ff3a4ffe7d6d185a207c327b23513f3f573..9a2f5050f21ec284a2d642cb8e5b0c7af11a0c03 100644 --- a/include/dlcom/comfactory.hpp +++ b/include/dlcom/comfactory.hpp @@ -21,16 +21,16 @@ namespace by { UNKNOWN_IMP2(IComObjectFrameworkClassFactory, IClassFactory__); public: - std_method(init_class)(IModuleBase* prot, IModuleBase* punkOuter) + std_method(init_class)(IBase* prot, IBase* punkOuter) { return !punkOuter ? S_OK : E_INVALIDARG; } - std_method(init_class_inner)(IModuleBase* punkOuter) + std_method(init_class_inner)(IBase* punkOuter) { return !punkOuter ? S_OK : E_INVALIDARG; } //IComObjectFrameworkClassFactory - std_method(CreateInstance)(IModuleBase *prot, IModuleBase *punkOuter, const IID& riid, void **ppv) + std_method(CreateInstance)(IBase *prot, IBase *punkOuter, const IID& riid, void **ppv) { return create_instance(prot, punkOuter, riid, ppv); } @@ -56,7 +56,7 @@ namespace by { return ""; } // IClassFactory - std_method(CreateInstance)(IModuleBase *punkOuter,REFIID riid,void **ppv) + std_method(CreateInstance)(IBase *punkOuter,REFIID riid,void **ppv) { return create_instance(punkOuter, riid, ppv); } @@ -65,11 +65,11 @@ namespace by { return lock_server(fLock); } public: - static HRESULT create_instance(IModuleBase *prot, IModuleBase *punkOuter, const IID& riid, void **ppv) + static HRESULT create_instance(IBase *prot, IBase *punkOuter, const IID& riid, void **ppv) { *ppv = 0; // aggregation validate: - retrtpv(!punkOuter || re_uuidof(IModuleBase) == riid, E_INVALIDARG); + retrtpv(!punkOuter || _uuidof(IBase) == riid, E_INVALIDARG); // create new object/aggregation: sentry p(new CLS); retrtpv(p, E_UNEXPECTED); @@ -79,11 +79,11 @@ namespace by { ((IUnknown_Nondelegate*)p.detach())->Release_Nondelegate(); // nondelegation, balance reference count or destroy. return hr; } - static HRESULT create_instance(IModuleBase *punkOuter, const IID& riid, void **ppv) + static HRESULT create_instance(IBase *punkOuter, const IID& riid, void **ppv) { *ppv = 0; // aggregation validate: - retrtpv(!punkOuter || re_uuidof(IModuleBase) == riid, E_INVALIDARG); + retrtpv(!punkOuter || _uuidof(IBase) == riid, E_INVALIDARG); // create new object/aggregation: sentry p(new CLS); retrtpv(p, E_UNEXPECTED); @@ -119,7 +119,7 @@ public: public: - std_method_(HRESULT, CreateInstance)(IModuleBase *pUnkOuter, REFIID riid, void **ppvObject) + std_method_(HRESULT, CreateInstance)(IBase *pUnkOuter, REFIID riid, void **ppvObject) { return create_instance(pUnkOuter, riid, ppvObject); } @@ -128,11 +128,11 @@ public: return lock_server(fLock); } public: - static HRESULT create_instance(IModuleBase *punkOuter, REFIID riid, void **ppv) + static HRESULT create_instance(IBase *punkOuter, REFIID riid, void **ppv) { *ppv = 0; // aggregation validate: - retrtpv(!punkOuter || re_uuidof(IModuleBase) == riid, E_INVALIDARG); + retrtpv(!punkOuter || _uuidof(IBase) == riid, E_INVALIDARG); // create new object/aggregation: sentry p(new CLS); retrtpv(p, E_UNEXPECTED); @@ -174,11 +174,11 @@ class TStdClsFactory : public TClsFactory public: // IRSBase: UNKNOWN_IMP2(IComObjectFrameworkClassFactory, IClassFactory__); - std_method(init_class)(IModuleBase* prot, IModuleBase* punkOuter) + std_method(init_class)(IBase* prot, IBase* punkOuter) { return !punkOuter ? S_OK : E_INVALIDARG; } - std_method(init_class_inner)(IModuleBase* punkOuter) + std_method(init_class_inner)(IBase* punkOuter) { return !punkOuter ? S_OK : E_INVALIDARG; } @@ -186,7 +186,7 @@ public: // IRSBase: public: - std_method(CreateInstance)(IModuleBase *prot, IModuleBase *punkOuter, REFIID riid, void **ppv) + std_method(CreateInstance)(IBase *prot, IBase *punkOuter, REFIID riid, void **ppv) { return create_instance(prot, punkOuter, riid, ppv); } @@ -248,11 +248,11 @@ public: #endif public: - static HRESULT create_instance(IModuleBase *prot, IModuleBase *punkOuter, REFIID riid, void **ppv) + static HRESULT create_instance(IBase *prot, IBase *punkOuter, REFIID riid, void **ppv) { *ppv = 0; // aggregation validate: - retrtpv(!punkOuter || re_uuidof(IModuleBase) == riid, E_INVALIDARG); + retrtpv(!punkOuter || _uuidof(IBase) == riid, E_INVALIDARG); // create new object/aggregation: sentry p(new CLS); retrtpv(p, E_UNEXPECTED); @@ -270,18 +270,18 @@ public: -class CNullObjcetUnkown : public IModuleBase, +class CNullObjcetUnkown : public IBase, private CUnknownImp { public: - UNKNOWN_IMP1(IModuleBase); + UNKNOWN_IMP1(IBase); - std_method(init_class)(IModuleBase* prot, IModuleBase* punkOuter) + std_method(init_class)(IBase* prot, IBase* punkOuter) { return !punkOuter ? S_OK : E_INVALIDARG; } - std_method(init_class_inner)(IModuleBase* punkOuter) + std_method(init_class_inner)(IBase* punkOuter) { return !punkOuter ? S_OK : E_INVALIDARG; } diff --git a/include/dlcom/comfunc.hpp b/include/dlcom/comfunc.hpp index 85265356c831eb3d74b88b214f2892e6f9167bed..07a6d1dae9d1ebc99a0ac58ab8e21b490eb0cd0b 100644 --- a/include/dlcom/comfunc.hpp +++ b/include/dlcom/comfunc.hpp @@ -31,23 +31,23 @@ namespace by { std_method(QueryInterface)(REFGUID riid, void **ppv) { \ #define QIUNKNOWN \ - if(re_uuidof(IModuleBase) == riid) \ + if(_uuidof(IBase) == riid) \ { \ - *ppv = static_cast(this); \ + *ppv = static_cast(this); \ AddRef(); \ return S_OK; \ } \ #define QIUNKNOWN_(icast) \ - if(re_uuidof(IModuleBase) == riid) \ + if(_uuidof(IBase) == riid) \ { \ - *ppv = static_cast(static_cast(this)); \ + *ppv = static_cast(static_cast(this)); \ AddRef(); \ return S_OK; \ } \ #define QIENTRY(iface) \ - if(re_uuidof(iface) == riid) \ + if(_uuidof(iface) == riid) \ { \ *ppv = static_cast(this); \ AddRef(); \ @@ -55,7 +55,7 @@ namespace by { } \ #define QIENTRY_(iface, icast) \ - if(re_uuidof(iface) == riid) \ + if(_uuidof(iface) == riid) \ { \ *ppv = static_cast(static_cast(this)); \ AddRef(); \ @@ -91,6 +91,10 @@ namespace by { #define UNKNOWN_IMP_SPEC_(icast, entrys) \ QIBEGIN QIUNKNOWN_(icast) entrys QIEND ADDREF RELEASE +#define UNKNOWN_IMP_SPEC_MEM(entrys) \ + QIBEGIN QIUNKNOWN entrys QIEND ADDREF + + #define ADDREF_EX \ std_method_(ULONG, AddRef)() \ @@ -112,6 +116,7 @@ namespace by { #define UNKNOWN_IMP_SPEC_EX(entrys) \ QIBEGIN QIUNKNOWN entrys QIEND ADDREF_EX RELEASE_EX + #define UNKNOWN_IMP1(i) \ UNKNOWN_IMP_SPEC( QIENTRY(i) ) #define UNKNOWN_IMP2(i1, i2) \ @@ -135,6 +140,11 @@ namespace by { UNKNOWN_IMP_SPEC_(i1, QIENTRY(i1) QIENTRY(i2) QIENTRY(i3) QIENTRY(i4) QIENTRY(i5) ) + +#define UNKNOWN_IMP1_MEM(i) \ + UNKNOWN_IMP_SPEC_MEM( QIENTRY(i) ) + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -156,8 +166,8 @@ namespace by { } public: - IModuleBase *m_punkOuter; - HRESULT init_class_inner(IModuleBase *punkOuter) + IBase *m_punkOuter; + HRESULT init_class_inner(IBase *punkOuter) { m_punkOuter = punkOuter; return S_OK; @@ -170,7 +180,7 @@ namespace by { std_method(QueryInterface_Nondelegate)(REFGUID riid, void **ppv) { #define QIUNKNOWN_NONDELEGATE \ - if(re_uuidof(IModuleBase) == riid) \ + if(_uuidof(IBase) == riid) \ { \ *ppv = static_cast(this); \ AddRef_Nondelegate(); \ @@ -178,7 +188,7 @@ namespace by { } \ #define QIUNKNOWN_NONDELEGATE_(icast) \ - if(re_uuidof(IModuleBase) == riid) \ + if(_uuidof(IBase) == riid) \ { \ *ppv = static_cast(static_cast(this)); \ AddRef_Nondelegate(); \ @@ -310,8 +320,8 @@ namespace by { } public: - com_ptr m_punkInner; - HRESULT init_class_outer(IModuleBase *prot, IModuleBase *punkThisOuter, const CLSID& rclsid) + com_ptr m_punkInner; + HRESULT init_class_outer(IBase *prot, IBase *punkThisOuter, const CLSID& rclsid) { retrtpv(prot, E_INVALIDARG); @@ -319,9 +329,9 @@ namespace by { retrtpv(pRot, E_INVALIDARG); com_ptr pol; - RFAILED(pRot->GetObject(CLSID_CObjectLoader, re_uuidof(IObjectLoader), (IModuleBase**)&pol)); + RFAILED(pRot->GetObject(CLSID_CObjectLoader, _uuidof(IObjectLoader), (IBase**)&pol)); - RFAILED(pol->CreateInstance(prot, rclsid, punkThisOuter, re_uuidof(IModuleBase), (void**)&m_punkInner)); + RFAILED(pol->CreateInstance(prot, rclsid, punkThisOuter, _uuidof(IBase), (void**)&m_punkInner)); return S_OK; } diff --git a/include/dlcom/cominc.hpp b/include/dlcom/cominc.hpp index b0e352d42526fa83f412c2ad441c7be39e73dcd4..f4e62d194ccbefe3d14416115af4605bbb621dee 100644 --- a/include/dlcom/cominc.hpp +++ b/include/dlcom/cominc.hpp @@ -2,5 +2,16 @@ #define _COM_INC_H_ +#include + +#include +#include +#include +#include +using namespace by; + +#include +#include + #endif diff --git a/include/dlcom/comsentry.hpp b/include/dlcom/comsentry.hpp index 94340f3b86b0049a9d135dd4cd8a9b1d57779c49..2531c2e4173c1a36d206088b17f81ff98c24ba2f 100644 --- a/include/dlcom/comsentry.hpp +++ b/include/dlcom/comsentry.hpp @@ -199,25 +199,25 @@ namespace by { template com_ptr(const com_ptr& rhs) : base() { - if(rhs.m_p && FAILED(rhs.m_p->QueryInterface(re_uuidof(I), (void**)&m_p))) + if(rhs.m_p && FAILED(rhs.m_p->QueryInterface(_uuidof(I), (void**)&m_p))) m_p = 0; } // gcc com_ptr(const com_ptr& rhs) : base() { - if(rhs.m_p && FAILED(rhs.m_p->QueryInterface(re_uuidof(I), (void**)&m_p))) + if(rhs.m_p && FAILED(rhs.m_p->QueryInterface(_uuidof(I), (void**)&m_p))) m_p = 0; } // gcc template com_ptr(const sentry& rhs) : base() { - if(rhs.m_p && FAILED(rhs.m_p->QueryInterface(re_uuidof(I), (void**)&m_p))) + if(rhs.m_p && FAILED(rhs.m_p->QueryInterface(_uuidof(I), (void**)&m_p))) m_p = 0; } // gcc template com_ptr(U *p) : base() { - if(p && FAILED(p->QueryInterface(re_uuidof(I), (void**)&m_p))) + if(p && FAILED(p->QueryInterface(_uuidof(I), (void**)&m_p))) m_p = 0; } // operator =: @@ -248,7 +248,7 @@ namespace by { if((void*)m_p == (void*)p) return *this; base::operator=(0); - if(p && FAILED(p->QueryInterface(re_uuidof(I), (void**)&m_p))) + if(p && FAILED(p->QueryInterface(_uuidof(I), (void**)&m_p))) m_p = 0; return *this; } diff --git a/include/dlcom/conntopoint/UseConnectionPoint.h b/include/dlcom/conntopoint/UseConnectionPoint.h new file mode 100644 index 0000000000000000000000000000000000000000..6275795deaf423e80cbec0c5ea7cf6c9d472be94 --- /dev/null +++ b/include/dlcom/conntopoint/UseConnectionPoint.h @@ -0,0 +1,62 @@ +#ifndef _USECONNECTIONPOINT_HELPER_H_ +#define _USECONNECTIONPOINT_HELPER_H_ + +#include +#include + +namespace by { + +template +class UseConnectPoint +{ +public: + com_ptr m_pConnectPoint; + DWORD m_dwConnectPointCookie; + BOOL m_bConnected; + + UseConnectPoint():m_dwConnectPointCookie(-1),m_bConnected(FALSE) + { + + }; + ~UseConnectPoint() + { + DisConnect(); + } + + HRESULT Connect(IBase* pConnectionPointContainer, IBase* pThis) + { + com_ptr pCPC(pConnectionPointContainer); + RASSERT(pCPC, E_FAIL); + + RFAILED(pCPC->FindConnectionPoint(_uuidof(iid), (IConnectionPoint**)&m_pConnectPoint)); + return Connect(pThis); + } + + HRESULT Connect(IBase* pThis) + { + RASSERT(m_pConnectPoint, E_FAIL); + + com_ptr pMCP(pThis); + RFAILED(m_pConnectPoint->Advise(pMCP, &m_dwConnectPointCookie)); + + m_bConnected = TRUE; + return S_OK; + } + + HRESULT DisConnect() + { + if(m_pConnectPoint) + { + if(m_bConnected) + m_pConnectPoint->Unadvise(m_dwConnectPointCookie); + m_pConnectPoint = INULL; + } + + m_bConnected = FALSE; + return FALSE; + } +}; + +} + +#endif \ No newline at end of file diff --git a/include/dlcom/conntopoint/connectionpoint.h b/include/dlcom/conntopoint/connectionpoint.h new file mode 100644 index 0000000000000000000000000000000000000000..f4e71c0465a90f88e6578e9b403eab7fbdee4f44 --- /dev/null +++ b/include/dlcom/conntopoint/connectionpoint.h @@ -0,0 +1,61 @@ +#ifndef _CONNECTIONPOINT_H_ +#define _CONNECTIONPOINT_H_ + +#include +#include + +namespace by { + +typedef struct tagCONNECTDATA +{ + com_ptr pUnk; + DWORD dwCookie; +} CONNECTDATA; + +typedef CONNECTDATA *LPCONNECTDATA; + +interface IEnumConnections : public IBase +{ +public: + STDMETHOD(Next)(ULONG cConnections, LPCONNECTDATA rgcd, ULONG *pcFetched) = 0; + STDMETHOD(Skip)(ULONG cConnections) = 0; + STDMETHOD(Reset)(void) = 0; + STDMETHOD(Clone)(IEnumConnections **ppEnum) = 0; +}; +_DEFINE_IID(IEnumConnections, "{966C3BF0-2452-4741-A5EB-0FE3C897B66D}"); + +interface IConnectionPointContainer; + +interface IConnectionPoint : public IBase +{ +public: + STDMETHOD(GetConnectionInterface)(IID *pIID) = 0; + STDMETHOD(GetConnectionPointContainer)(IConnectionPointContainer **ppCPC) = 0; + STDMETHOD(Advise)(IBase *pUnkSink, DWORD *pdwCookie) = 0; + STDMETHOD(Unadvise)(DWORD dwCookie) = 0; + STDMETHOD(EnumConnections)(IEnumConnections **ppEnum) = 0; +}; +typedef IConnectionPoint *LPCONNECTIONPOINT; + +_DEFINE_IID(IConnectionPoint, "{FA053C5F-9CDE-4d43-BE8D-BF9C8D6B3BC1}"); + +////////////////////////////////////////////////////////////////////////// +interface IEnumConnectionPoints : public IBase +{ +public: + STDMETHOD(Next)( ULONG cConnections,LPCONNECTIONPOINT *ppCP, ULONG *pcFetched) = 0; + STDMETHOD(Skip)( ULONG cConnections ) = 0; + STDMETHOD(Reset)( void) = 0; + STDMETHOD(Clone)(IEnumConnectionPoints **ppEnum) = 0; +}; +_DEFINE_IID(IEnumConnectionPoints, "{720E4D89-F10F-472b-9B0C-0FE9F881D448}"); + +interface IConnectionPointContainer : public IBase +{ + STDMETHOD(EnumConnectionPoints)(IEnumConnectionPoints **ppEnum) = 0; + STDMETHOD(FindConnectionPoint)(REFIID riid, IConnectionPoint **ppCP) = 0; +}; +_DEFINE_IID(IConnectionPointContainer, "{EA3E2924-A205-41a3-85DE-40DABD266745}"); + +} +#endif \ No newline at end of file diff --git a/include/dlcom/conntopoint/connectionpointhelper.h b/include/dlcom/conntopoint/connectionpointhelper.h new file mode 100644 index 0000000000000000000000000000000000000000..667e0f5aedcacea182c15936cc21b68ce6b62f46 --- /dev/null +++ b/include/dlcom/conntopoint/connectionpointhelper.h @@ -0,0 +1,412 @@ +#ifndef _CONNECTIONPOINT_HELPER_H_ +#define _CONNECTIONPOINT_HELPER_H_ + +#include +#include + +namespace by { +////////////////////////////////////////////////////////////////////////// +struct ST_ConnectionPoint +{ + IID iid; + com_ptr p; +}; +typedef std::vector CONNECTIONPOINTS, *LPCONNECTIONPOINTS; + +class CConnectionPointHelper; +class CEnumConnectionPoints + : public IEnumConnectionPoints + , public CUnknownImp +{ +public: + CEnumConnectionPoints(CONNECTIONPOINTS& ConnectionPoints) + : m_ulEnumConnectionPointsPos(0) + , m_ConnectionPoints(ConnectionPoints) + {} + + UNKNOWN_IMP1(IEnumConnectionPoints); + + STDMETHOD(Next)( ULONG cConnections, LPCONNECTIONPOINT *ppCP, ULONG *pcFetched) + { + if(pcFetched) + *pcFetched = 0; + RASSERT(cConnections, S_OK); + RASSERT(ppCP, S_FALSE); + + size_t sSize = m_ConnectionPoints.size(); + if(0 == sSize) + { + return S_FALSE; + } + + ULONG i = 0; + while((i < cConnections) && (m_ulEnumConnectionPointsPos < sSize)) + { + if(m_ConnectionPoints[m_ulEnumConnectionPointsPos].p) + m_ConnectionPoints[m_ulEnumConnectionPointsPos].p->QueryInterface(_uuidof(IRsConnectionPoint), (void**)&ppCP[i]); + + ++m_ulEnumConnectionPointsPos; + ++i; + } + + if(i < cConnections) + { + if(pcFetched) + *pcFetched = 0; + return S_FALSE; + } + + return S_OK; + } + + STDMETHOD(Skip)( ULONG cConnections ) + { + m_ulEnumConnectionPointsPos += cConnections; + return S_OK; + } + + STDMETHOD(Reset)( void ) + { + m_ulEnumConnectionPointsPos = 0; + return S_OK; + } + + STDMETHOD(Clone)(IEnumConnectionPoints **ppEnum) + { + RASSERT(ppEnum, E_POINTER); + + CEnumConnectionPoints* pNew = new CEnumConnectionPoints(m_ConnectionPoints); + HRESULT hr = pNew->QueryInterface(_uuidof(IEnumConnectionPoints), (void**)ppEnum); + if(NULL == *ppEnum) + { + delete pNew; + pNew = NULL; + } + + return hr; + } + +private: + ULONG m_ulEnumConnectionPointsPos; + CONNECTIONPOINTS& m_ConnectionPoints; +}; + +#define CallConnectPointFunc(obj, iid, func) { \ + com_ptr pEnum; \ + if(SUCCEEDED(obj.EnumConnections((IEnumConnections**)&pEnum)) && pEnum){ \ + HRESULT hNext = S_OK; \ + while(S_OK == hNext){ \ + CONNECTDATA data[1]; \ + \ + if(S_OK == (hNext=pEnum->Next(1, data, NULL))){ \ + com_ptr p = data[0].pUnk; \ + if(p) p->func; \ + }}}\ +} + +#define CallConnectPointFunc_Tc(obj, iid, func, rc, tc) { \ + com_ptr pEnum; \ + if(SUCCEEDED(obj.EnumConnections((IEnumConnections**)&pEnum)) && pEnum){ \ + HRESULT hNext = S_OK; \ + while(S_OK == hNext){ \ + CONNECTDATA data[1]; \ + \ + if(S_OK == (hNext=pEnum->Next(1, data, NULL))){ \ + com_ptr p = data[0].pUnk; \ + if(p){ rc=p->func; if(tc(rc)) break;}\ + }}}\ +} + + +template +class CConnectionPointContainerHelper + : public IConnectionPointContainer +{ +protected: + CONNECTIONPOINTS m_ConnectionPoints; + +public: + STDMETHOD(EnumConnectionPoints)(IEnumConnectionPoints **ppEnum) + { + RASSERT(ppEnum, E_POINTER); + + CEnumConnectionPoints* pNew = new CEnumConnectionPoints(m_ConnectionPoints); + HRESULT hr = pNew->QueryInterface(_uuidof(IEnumConnectionPoints), (void**)ppEnum); + if(NULL == *ppEnum) + { + delete pNew; + pNew = NULL; + } + + return hr; + } + + STDMETHOD(FindConnectionPoint)(REFIID riid, IConnectionPoint **ppCP) + { + RASSERT(ppCP, E_POINTER); + RASSERT( m_ConnectionPoints.size() > 0, E_NOINTERFACE ); + + CONNECTIONPOINTS::const_iterator it = m_ConnectionPoints.begin(); + for(; it != m_ConnectionPoints.end(); it++) + { + if(it->iid == riid) + { + RASSERT(it->p, E_POINTER); + RFAILED(it->p->QueryInterface(_uuidof(IConnectionPoint), (void**)ppCP)); + RASSERT(*ppCP, E_POINTER); + return S_OK; + } + } + + return E_NOINTERFACE; + } + + virtual void EmptyConnectionPointContainer() + { + m_ConnectionPoints.clear(); + } + + virtual BOOL AddConnectionPoint(IID iid, IConnectionPoint* p) + { + RASSERT(p, FALSE); + + ST_ConnectionPoint point; + point.iid = iid; + point.p = p; + m_ConnectionPoints.push_back(point); + return TRUE; + } + + virtual BOOL AddConnectionPoint(IID iid, CConnectionPointHelper &connectPointHelper, BOOL bAddRef = TRUE) + { + T* pThis = static_cast(this); + com_ptr p = pThis; + RASSERT(p, FALSE); + connectPointHelper.SetInfo(iid, p); + + if(bAddRef) + connectPointHelper.AddRef(); + + com_ptr pPoint(&connectPointHelper); + return AddConnectionPoint(iid, pPoint); + } + + virtual BOOL DelConnectionPoint(REFIID riid) + { + CONNECTIONPOINTS::iterator it = m_ConnectionPoints.begin(); + for(; it != m_ConnectionPoints.end(); it++) + { + if(it->iid == riid) + { + m_ConnectionPoints.erase(it); + return TRUE; + } + } + return FALSE; + } + + virtual BOOL DelConnectionPoint(REFIID riid, CConnectionPointHelper &connectPointHelper) + { + connectPointHelper.EmptyConnection(); + return DelConnectionPoint(riid); + } +}; + + +struct ST_CONNECTDATA +{ + DWORD dwCookie; + com_ptr p; +}; +typedef std::vector CONNECTIONS, *LPCONNECTIONS; + +class CConnectionPointHelper + : public IConnectionPoint + , public CUnknownImp +{ +public: + CConnectionPointHelper(IID iid = GUID_NULL, IConnectionPointContainer* pContainer = NULL) + : m_iidConnectionPoint(iid) + , m_pContainer(pContainer) + , m_dwCookieNum(0) + {} + + UNKNOWN_IMP1(IConnectionPoint); + + void SetInfo(IID iid, IConnectionPointContainer* pContainer = NULL) + { + m_iidConnectionPoint = iid; + m_pContainer = pContainer; + } + + STDMETHOD(GetConnectionInterface)(IID *pIID) + { + RASSERT(pIID, E_POINTER); + + *pIID = m_iidConnectionPoint; + return S_OK; + } + STDMETHOD(GetConnectionPointContainer)(IConnectionPointContainer **ppCPC) + { + RASSERT(ppCPC, E_POINTER); + + *ppCPC = m_pContainer; + RASSERT(*ppCPC, E_POINTER); + + return S_OK; + } + STDMETHOD(Advise)(IBase *pUnkSink, DWORD *pdwCookie) + { + RASSERT(pUnkSink, E_POINTER); + RASSERT(pdwCookie, E_POINTER); + + *pdwCookie = ++m_dwCookieNum; + + ST_CONNECTDATA data; + data.dwCookie = *pdwCookie; + data.p = pUnkSink; + m_Connections.push_back(data); + + return S_OK; + } + STDMETHOD(Unadvise)(DWORD dwCookie) + { + CONNECTIONS::iterator it = m_Connections.begin(); + for(; it != m_Connections.end(); it++) + { + if(it->dwCookie == dwCookie) + { + m_Connections.erase(it); + return S_OK; + } + } + + return E_NOINTERFACE; + } + STDMETHOD(EnumConnections)(IEnumConnections **ppEnum) + { + RASSERT(ppEnum, E_POINTER); + + CEnumConnections* pNew = new CEnumConnections(m_Connections); + HRESULT hr = pNew->QueryInterface(_uuidof(IEnumConnections), (void**)ppEnum); + if(NULL == *ppEnum) + { + delete pNew; + pNew = NULL; + } + + return hr; + } + + virtual void EmptyConnection() + { + CONNECTIONS holdRef = m_Connections; + m_Connections.clear(); + m_pContainer = INULL; + } + + virtual HRESULT FindConnection(DWORD dwCookie, IID iid, void** p) + { + RASSERT(m_Connections.size() > 0, E_NOINTERFACE); + + for(size_t i = 0; i < m_Connections.size(); i++) + { + ST_CONNECTDATA &data = m_Connections[i]; + if(data.dwCookie == dwCookie) + { + RASSERT(data.p, E_NOINTERFACE); + return data.p->QueryInterface(iid, p); + } + } + + return E_NOINTERFACE; + } + ////////////////////////////////////////////////////////////////////////// + class CEnumConnections + : public IEnumConnections + , public CUnknownImp + { + public: + CEnumConnections(CONNECTIONS& Connections) + : m_ulEnumConnectionPos(0) + , m_Connections(Connections) + {} + UNKNOWN_IMP1(IEnumConnections); + + STDMETHOD(Next)( ULONG cConnections, LPCONNECTDATA rgcd, ULONG *pcFetched ) + { + if(pcFetched) + *pcFetched = 0; + + RASSERT(cConnections, S_OK); + RASSERT(rgcd, S_FALSE); + + size_t sSize = m_Connections.size(); + if(0 == sSize) + { + return S_FALSE; + } + + ULONG i = 0; + while((i < cConnections) && (m_ulEnumConnectionPos < sSize)) + { + rgcd[i].dwCookie = m_Connections[m_ulEnumConnectionPos].dwCookie; + if(m_Connections[m_ulEnumConnectionPos].p) + m_Connections[m_ulEnumConnectionPos].p->QueryInterface(_uuidof(IBase), (void**)&rgcd[i].pUnk); + + ++m_ulEnumConnectionPos; + ++i; + } + + if(i < cConnections) + { + if(pcFetched) + *pcFetched = 0; + + return S_FALSE; + } + + return S_OK; + } + + STDMETHOD(Skip)( ULONG cConnections ) + { + m_ulEnumConnectionPos += cConnections; + return S_OK; + } + + STDMETHOD(Reset)( void ) + { + m_ulEnumConnectionPos = 0; + return S_OK; + } + + STDMETHOD(Clone)(IEnumConnections **ppEnum) + { + RASSERT(ppEnum, E_POINTER); + + CEnumConnections* pNew = new CEnumConnections(m_Connections); + HRESULT hr = pNew->QueryInterface(_uuidof(IEnumConnections), (void**)ppEnum); + if(NULL == *ppEnum) + { + delete pNew; + pNew = NULL; + } + + return hr; + } + private: + ULONG m_ulEnumConnectionPos; + CONNECTIONS &m_Connections; + }; + +protected: + IID m_iidConnectionPoint; + com_ptr m_pContainer; + DWORD m_dwCookieNum; + CONNECTIONS m_Connections; +}; + +} + +#endif \ No newline at end of file diff --git a/include/dlcom/ibase.h b/include/dlcom/ibase.h index c54cb972503a5d8da9b680b9548076a437138d98..0d1d42c552ef35ae270f132d992010a880fba173 100644 --- a/include/dlcom/ibase.h +++ b/include/dlcom/ibase.h @@ -13,21 +13,21 @@ namespace by { - interface IComObjectFrameworkClassFactory: public IClassFactory__ + interface IComObjectFrameworkClassFactory : public IClassFactory__ { public: - std_method(CreateInstance)(IModuleBase *prot, IModuleBase *punkOuter, REFIID riid, void **ppvObject) =0; + std_method(CreateInstance)(IBase *prot, IBase *punkOuter, REFIID riid, void **ppvObject) =0; std_method_(CLSID, GetAt)(LONG nIndex) = 0; std_method_(LONG, GetCount)() = 0; std_method_(LPCSTR, ProgIDFromCLSID)(REFCLSID clsid) = 0; }; - MD_DEFINE_IID(IComObjectFrameworkClassFactory,"{6966E385-DBFA-4131-A29E-D0E9464F3F53}"); + _DEFINE_IID(IComObjectFrameworkClassFactory,"{6966E385-DBFA-4131-A29E-D0E9464F3F53}"); // {E2247B54-E329-4ca8-8361-6499FDFF98F4} - MD_DEFINE_GUID(CLSID_ComObjectFrameworkClassFactory, + _DEFINE_GUID(CLSID_ComObjectFrameworkClassFactory, 0xe2247b54, 0xe329, 0x4ca8, 0x83, 0x61, 0x64, 0x99, 0xfd, 0xff, 0x98, 0xf4); - interface IProperty : public IModuleBase + interface IProperty : public IBase { typedef GUID KeyType; std_method(SetProperty)(const GUID& rpid, const PROPVARIANT *pv) = 0; @@ -35,15 +35,15 @@ namespace by { std_method(DeleteProperty)(const GUID& rpid) = 0; std_method(Clear)() = 0; }; - MD_DEFINE_IID(IProperty, "{39AA125E-D7F1-46b1-82EB-6D8527269279}"); + _DEFINE_IID(IProperty, "{39AA125E-D7F1-46b1-82EB-6D8527269279}"); // {ED20E0E5-2357-4825-B3FA-198AEC674E81} - MD_DEFINE_GUID(CLSID_CProperty, + _DEFINE_GUID(CLSID_CProperty, 0xed20e0e5, 0x2357, 0x4825, 0xb3, 0xfa, 0x19, 0x8a, 0xec, 0x67, 0x4e, 0x81); // {AD4F3A47-0CD6-43de-BC22-E8BE24FFD424} - MD_DEFINE_GUID(CLSID_CProperty_thread, + _DEFINE_GUID(CLSID_CProperty_thread, 0xad4f3a47, 0xcd6, 0x43de, 0xbc, 0x22, 0xe8, 0xbe, 0x24, 0xff, 0xd4, 0x24); //------------------------------------------------------------------------------- - interface IProperty2 : public IModuleBase + interface IProperty2 : public IBase { typedef DWORD KeyType; @@ -52,17 +52,17 @@ namespace by { std_method(DeleteProperty)(const DWORD& rpid) = 0; std_method(Clear)() = 0; }; - MD_DEFINE_IID(IProperty2, "{21C975F4-EEE1-4c90-8D39-7D94A6AEDAB7}"); + _DEFINE_IID(IProperty2, "{21C975F4-EEE1-4c90-8D39-7D94A6AEDAB7}"); // {2100E98D-B13E-4306-8081-50F325B10586} - MD_DEFINE_GUID(CLSID_CProperty2, + _DEFINE_GUID(CLSID_CProperty2, 0x2100e98d, 0xb13e, 0x4306, 0x80, 0x81, 0x50, 0xf3, 0x25, 0xb1, 0x5, 0x86); // {0AEF80FB-9BAF-4e66-96B3-784ED0FCECF1} - MD_DEFINE_GUID(CLSID_CProperty2_thread, + _DEFINE_GUID(CLSID_CProperty2_thread, 0xaef80fb, 0x9baf, 0x4e66, 0x96, 0xb3, 0x78, 0x4e, 0xd0, 0xfc, 0xec, 0xf1); //com factory you must define // {E9678781-A3CB-46fb-9121-3ED22C24CFAD} - MD_DEFINE_GUID(CLSID_MDClassFactory, + _DEFINE_GUID(CLSID_MDClassFactory, 0xe9678781, 0xa3cb, 0x46fb, 0x91, 0x21, 0x3e, 0xd2, 0x2c, 0x24, 0xcf, 0xad); diff --git a/include/dlcom/icombase.h b/include/dlcom/icombase.h index e8b5c49da5449c4be94dad419246171a5a6b5b2e..1e07a238f3aa7ba568d0adcf974a368607519282 100644 --- a/include/dlcom/icombase.h +++ b/include/dlcom/icombase.h @@ -6,20 +6,20 @@ namespace by { ////////////////////////////////////////////////////////////////////////// -interface IObjectLoader : public IModuleBase +interface IObjectLoader : public IBase { - std_method(CreateInstance)(IModuleBase* prot, const CLSID& rclsid, IModuleBase *punkOuter, const IID& riid, void **ppv) = 0; + std_method(CreateInstance)(IBase* prot, const CLSID& rclsid, IBase *punkOuter, const IID& riid, void **ppv) = 0; }; -MD_DEFINE_IID(IObjectLoader, "{1C97345C-7834-4218-8BA8-C0E04F642118}"); +_DEFINE_IID(IObjectLoader, "{1C97345C-7834-4218-8BA8-C0E04F642118}"); interface IObjectLoaderEx : public IObjectLoader { std_method_(LPCSTR, ProgIDFromCLSID)(REFCLSID clsid) = 0; std_method_(CLSID, CLSIDFromProgID)(LPCSTR lpProgId) = 0; }; -MD_DEFINE_IID(IObjectLoaderEx, "{F2527941-9539-44f9-AABE-A2A325274C92}"); +_DEFINE_IID(IObjectLoaderEx, "{F2527941-9539-44f9-AABE-A2A325274C92}"); -interface IOLManager : public IModuleBase +interface IOLManager : public IBase { public: std_method(Register)(const CLSID& rclsid, LPCTSTR filename, LPVOID lpGetProc = NULL) = 0; @@ -31,30 +31,30 @@ public: std_method_(DWORD, GetComponentModuleCount)() = 0; }; -MD_DEFINE_IID(IOLManager, "{E00AD446-D124-40f8-9397-D3D8425F3235}"); +_DEFINE_IID(IOLManager, "{E00AD446-D124-40f8-9397-D3D8425F3235}"); interface IOLManagerEx : public IOLManager { public: std_method(SetProgId)(const CLSID& rclsid, LPCSTR progId) = 0; }; -MD_DEFINE_IID(IOLManagerEx, "{844335FE-289B-4117-8CC1-B3E27E2621D3}"); +_DEFINE_IID(IOLManagerEx, "{844335FE-289B-4117-8CC1-B3E27E2621D3}"); // {4F496E7F-D8FD-4ded-967D-C4F53BFB9452} -MD_DEFINE_GUID(CLSID_CObjectLoader, +_DEFINE_GUID(CLSID_CObjectLoader, 0x4f496e7f, 0xd8fd, 0x4ded, 0x96, 0x7d, 0xc4, 0xf5, 0x3b, 0xfb, 0x94, 0x52); ////////////////////////////////////////////////////////////////////////// -interface IComRunningObjectTable : public IModuleBase +interface IComRunningObjectTable : public IBase { public: - std_method(Register)(const CLSID& rpid, IModuleBase *punk) = 0; + std_method(Register)(const CLSID& rpid, IBase *punk) = 0; std_method(Revoke)(const CLSID& rpid) = 0; std_method(IsRunning)(const CLSID& rpid) = 0; - std_method(GetObject)(const CLSID& rpid, const IID iid, IModuleBase **ppunk) = 0; + std_method(GetObject)(const CLSID& rpid, const IID iid, IBase **ppunk) = 0; std_method(RevokeAll)() = 0; }; -MD_DEFINE_IID(IComRunningObjectTable, "{50EAFCD5-FF5B-4744-9C3C-980A521A5DF3}"); +_DEFINE_IID(IComRunningObjectTable, "{50EAFCD5-FF5B-4744-9C3C-980A521A5DF3}"); interface IComRunningObjectTableEx : public IComRunningObjectTable { @@ -66,28 +66,28 @@ public: std_method(BeginEnum)() = 0; std_method_(BOOL, NextObject)(CLSID *pclsId) = 0; }; -MD_DEFINE_IID(IComRunningObjectTableEx, "{81079861-0A53-4820-8C73-7FC9F118EB02}"); +_DEFINE_IID(IComRunningObjectTableEx, "{81079861-0A53-4820-8C73-7FC9F118EB02}"); // {216DFF2F-B2F0-4ce0-BA5B-72E0B7BFAC28} -MD_DEFINE_GUID(ClSID_CRunningObjectTable, +_DEFINE_GUID(ClSID_CRunningObjectTable, 0x216dff2f, 0xb2f0, 0x4ce0, 0xba, 0x5b, 0x72, 0xe0, 0xb7, 0xbf, 0xac, 0x28); ////////////////////////////////////////////////////////////////////////// -interface IObjMgr : public IModuleBase +interface IObjMgr : public IBase { public: - std_method(CreateInstance)(const CLSID& rpid, const IID& riid, IModuleBase *punk, BOOL bFromRot) = 0; + std_method(CreateInstance)(const CLSID& rpid, const IID& riid, IBase *punk, BOOL bFromRot) = 0; std_method(ReleaseInstanceFromRot)(const CLSID& rpid) = 0; }; ////////////////////////////////////////////////////////////////////////// -interface IExit : public IModuleBase +interface IExit : public IBase { std_method(NotifyExit)(bool* bExit = NULL) = 0; }; -MD_DEFINE_IID(IExit, "{AFFA4FB2-EFF6-4371-AADD-62C0B0766178}"); +_DEFINE_IID(IExit, "{AFFA4FB2-EFF6-4371-AADD-62C0B0766178}"); -interface IObjectRun : public IModuleBase +interface IObjectRun : public IBase { std_method(Init)(HINSTANCE hInstance = NULL , LPCTSTR lpCfgName = NULL @@ -95,7 +95,7 @@ interface IObjectRun : public IModuleBase std_method_(INT, Run)() = 0; std_method(Uninit)() = 0; }; -MD_DEFINE_IID(IObjectRun, "{616C6DD6-95C9-4837-A2AE-939B52515F6D}"); +_DEFINE_IID(IObjectRun, "{616C6DD6-95C9-4837-A2AE-939B52515F6D}"); interface IComEnv : public IObjectRun @@ -110,19 +110,19 @@ interface IComEnv : public IObjectRun std_method_(INT, RunEnv)(const CLSID& mainPlugin) = 0; - std_method(GetRot)(IModuleBase** pRot, IID iid = re_uuidof(IComRunningObjectTable)) = 0; - std_method(GetObjectLoader)(IModuleBase** pRot, IID iid = re_uuidof(IObjectLoader)) = 0; + std_method(GetRot)(IBase** pRot, IID iid = _uuidof(IComRunningObjectTable)) = 0; + std_method(GetObjectLoader)(IBase** pRot, IID iid = _uuidof(IObjectLoader)) = 0; std_method_(LPCTSTR, GetXmlFile)() = 0; std_method_(LPCTSTR, GetXmlLib)() = 0; std_method_(LPCTSTR, GetRunPath)() = 0; std_method_(LPCTSTR, GetProcessName)() = 0; }; -MD_DEFINE_IID(IComEnv, "{50D6F56E-9C94-4060-B6EC-CF71CCB25CAA}"); +_DEFINE_IID(IComEnv, "{50D6F56E-9C94-4060-B6EC-CF71CCB25CAA}"); #define PARAMBUFSIZE 64 #define NAMEBUFSIZE 32 -interface IPluginObjectMgr : public IModuleBase +interface IPluginObjectMgr : public IBase { std_method(CreateObject)(const CLSID& clsid, unsigned long ulIndex, @@ -132,32 +132,32 @@ interface IPluginObjectMgr : public IModuleBase }; // {3F36891F-2BF6-4802-9A00-677CB423305A} -MD_DEFINE_IID(IPluginObjectMgr,"{3F36891F-2BF6-4802-9A00-677CB423305A}"); +_DEFINE_IID(IPluginObjectMgr,"{3F36891F-2BF6-4802-9A00-677CB423305A}"); // {E59BC62D-64AB-439d-BAF3-B2D1BA15E441} -MD_DEFINE_GUID(CLSID_ComEnv, +_DEFINE_GUID(CLSID_ComEnv, 0xe59bc62d, 0x64ab, 0x439d, 0xba, 0xf3, 0xb2, 0xd1, 0xba, 0x15, 0xe4, 0x41); // {C8CA7580-8E65-49e6-A66A-B087C7EF523D} -MD_DEFINE_GUID(CLSID_CMainRun, +_DEFINE_GUID(CLSID_CMainRun, 0xc8ca7580, 0x8e65, 0x49e6, 0xa6, 0x6a, 0xb0, 0x87, 0xc7, 0xef, 0x52, 0x3d); ////////////////////////////////////////////////////////////////////////// -interface IServerInfo : public IModuleBase +interface IServerInfo : public IBase { std_method_(BOOL, IsServerRun)() = 0; std_method_(LPCTSTR, GetServerName)() = 0; std_method_(LPCTSTR*, GetServerArg)(DWORD *pdwArgc) = 0; }; -MD_DEFINE_IID(IServerInfo, "{0332DE3F-1D6C-44c9-9158-8C9DF220B41F}"); +_DEFINE_IID(IServerInfo, "{0332DE3F-1D6C-44c9-9158-8C9DF220B41F}"); -interface IServiceCtrlConnectPoint : public IModuleBase +interface IServiceCtrlConnectPoint : public IBase { std_method_(DWORD, OnServiceCtrl)(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext) = 0; }; -MD_DEFINE_IID(IServiceCtrlConnectPoint, "{88E3C375-B6EA-4dd8-8C4E-FE00689AD25A}"); +_DEFINE_IID(IServiceCtrlConnectPoint, "{88E3C375-B6EA-4dd8-8C4E-FE00689AD25A}"); } diff --git a/include/dlcom/iplugin.h b/include/dlcom/iplugin.h index 6676ca2e3f8d67ca16d870d1facb7fd02caf23a8..a8d2f827b8f6bc16897f246c4e59d03792cdebac 100644 --- a/include/dlcom/iplugin.h +++ b/include/dlcom/iplugin.h @@ -5,18 +5,18 @@ namespace by { - interface IMdPlugin : public IModuleBase + interface IPlugin : public IBase { std_method(Init)(void*) = 0; std_method(Uninit)() = 0; }; - MD_DEFINE_IID(IMdPlugin, "{74252668-870B-4c27-B69D-C6E199C6D3D5}"); + _DEFINE_IID(IPlugin, "{74252668-870B-4c27-B69D-C6E199C6D3D5}"); - interface IMdPluginRun : public IModuleBase + interface IPluginRun : public IBase { std_method(Start)() = 0; std_method(Stop)() = 0; }; - MD_DEFINE_IID(IMdPluginRun, "{24AE3325-4FE1-4c03-8765-6C3C967D9D44}"); + _DEFINE_IID(IPluginRun, "{24AE3325-4FE1-4c03-8765-6C3C967D9D44}"); } #endif diff --git a/include/dlcom/loadcom.hpp b/include/dlcom/loadcom.hpp index 374f8458a671df3ea65eb05b45885ee6414cc99e..7d985e3ab38dab364afc0ebfc892de7056e51649 100644 --- a/include/dlcom/loadcom.hpp +++ b/include/dlcom/loadcom.hpp @@ -107,7 +107,7 @@ public: if(DllGetClassObject == NULL) return FALSE; - DllGetClassObject(CLSID_MDClassFactory, re_uuidof(IComObjectFrameworkClassFactory), (void**)&m_pClassFactory); + DllGetClassObject(CLSID_MDClassFactory, _uuidof(IComObjectFrameworkClassFactory), (void**)&m_pClassFactory); if(m_pClassFactory) { return TRUE; @@ -124,7 +124,7 @@ public: m_pClassFactory = INULL; UnLoad(); } - HRESULT CreateInstance(REFCLSID rclsid, IModuleBase *prot, IModuleBase *punkOuter, const IID& riid, void **ppv) + HRESULT CreateInstance(REFCLSID rclsid, IBase *prot, IBase *punkOuter, const IID& riid, void **ppv) { *ppv = NULL; @@ -134,14 +134,14 @@ public: m_pClassFactory = INULL; _lComPtr pClassFactory = INULL; - if(SUCCEEDED(DllGetClassObject(rclsid, re_uuidof(IComObjectFrameworkClassFactory), (void**)&pClassFactory)) && pClassFactory) + if(SUCCEEDED(DllGetClassObject(rclsid, _uuidof(IComObjectFrameworkClassFactory), (void**)&pClassFactory)) && pClassFactory) { return pClassFactory->CreateInstance(prot, punkOuter, riid, ppv); } */ _lComPtr pClassFactory; - if(SUCCEEDED(DllGetClassObject(rclsid, re_uuidof(IClassFactory__), (void**)&pClassFactory)) && pClassFactory) + if(SUCCEEDED(DllGetClassObject(rclsid, _uuidof(IClassFactory__), (void**)&pClassFactory)) && pClassFactory) { _lComPtr pOFClassFactory = pClassFactory; if(pOFClassFactory) diff --git a/include/dlcom/prophelpers.h b/include/dlcom/prophelpers.h index 3400399b3cb359f843a0e9ba57f02931c4a332df..670c78ce156b22a86d84534e6dd72ea2a9a7d0b4 100644 --- a/include/dlcom/prophelpers.h +++ b/include/dlcom/prophelpers.h @@ -282,7 +282,7 @@ public: // CPropSet props( pProp ); // props[0] = 123; // props[1] = _T("Uger"); -// props[2] = re_uuidof(IGenericRS); +// props[2] = _uuidof(IGenericRS); // props[3] = pBuffer; @@ -360,7 +360,7 @@ public: CPropVars( IUnknown* pProps ) { if( pProps ) - pProps->QueryInterface(re_uuidof(IFace), (void**)&m_pProps ); + pProps->QueryInterface(_uuidof(IFace), (void**)&m_pProps ); } ~CPropVars() @@ -372,7 +372,7 @@ public: CPropVars& operator=( IFace* pProps ) { if( pProps ) - pProps->QueryInterface(re_uuidof(IFace), (void**)&m_pProps ); + pProps->QueryInterface(_uuidof(IFace), (void**)&m_pProps ); return *this; } @@ -396,7 +396,7 @@ public: m_pProps = NULL; } - return pNew->QueryInterface(re_uuidof(IFace), (void**)&m_pProps ); + return pNew->QueryInterface(_uuidof(IFace), (void**)&m_pProps ); } IFace* GetFace( VOID ) diff --git a/include/dlcom/tproperty.h b/include/dlcom/tproperty.h index 8e73a719548ae9d2c6a62bf879f5c9fc6fe03d39..6883755bda0bb5e81c8090edcfd3fda28214f425 100644 --- a/include/dlcom/tproperty.h +++ b/include/dlcom/tproperty.h @@ -144,7 +144,7 @@ namespace by { public: // IUnknown: UNKNOWN_INNER_IMP1(IFace); public: // std factory invoke: - std_method(init_class)(IModuleBase* prot, IModuleBase *punkOuter) + std_method(init_class)(IBase* prot, IBase *punkOuter) { return init_class_inner(punkOuter); } diff --git a/include/dlcom/tproperty.impl.h b/include/dlcom/tproperty.impl.h index cf2bf0463c94defd4c82492ddb8a3e1878ea2b61..2127fa9a33370b4566baf98e9761130f3a85727b 100644 --- a/include/dlcom/tproperty.impl.h +++ b/include/dlcom/tproperty.impl.h @@ -65,23 +65,23 @@ struct prop_variant }; template<> -struct prop_variant +struct prop_variant { - IModuleBase *punkVal; + IBase *punkVal; static HRESULT construct_with(void *pThis, const void *pRhs) { - if(((((prop_variant*)pThis)->punkVal = ((const prop_variant*)pRhs)->punkVal)) != NULL) + if(((((prop_variant*)pThis)->punkVal = ((const prop_variant*)pRhs)->punkVal)) != NULL) { - ((prop_variant*)pThis)->punkVal->AddRef(); + ((prop_variant*)pThis)->punkVal->AddRef(); } return S_OK; } static HRESULT destroy(void *pThis) { - if(((prop_variant*)pThis)->punkVal) + if(((prop_variant*)pThis)->punkVal) { - ((prop_variant*)pThis)->punkVal->Release(); - ((prop_variant*)pThis)->punkVal = 0; + ((prop_variant*)pThis)->punkVal->Release(); + ((prop_variant*)pThis)->punkVal = 0; } return S_OK; } @@ -128,7 +128,7 @@ struct prop_type_traits PROP_DEF_NONTRIVIAL_TYPE_TRAITS(LPSTR); PROP_DEF_NONTRIVIAL_TYPE_TRAITS(LPWSTR); -PROP_DEF_NONTRIVIAL_TYPE_TRAITS(IModuleBase*); +PROP_DEF_NONTRIVIAL_TYPE_TRAITS(IBase*); PROP_DEF_NONTRIVIAL_TYPE_TRAITS(CLSID*); @@ -284,7 +284,7 @@ VariantEntryTable g_tblVariantEntry[] = // VT_VARIANT = 12, * VT_VARIANT [V][T][P][S] VARIANT * VARIANT_ENTRY_EMPTY, // VT_UNKNOWN = 13, * VT_UNKNOWN [V][T] [S] IUnknown * - VARIANT_ENTRY(IModuleBase*), + VARIANT_ENTRY(IBase*), // VT_DECIMAL = 14, * VT_DECIMAL [V][T] [S] 16 byte fixed point VARIANT_ENTRY_EMPTY, // 15 diff --git a/include/util/common.hpp b/include/util/common.hpp index 2dd77002a2263bc06cd234c0020f85cadfdfeeb5..202ffb9effb6d7fbbe32e5d87755143b4ce7e5a4 100644 --- a/include/util/common.hpp +++ b/include/util/common.hpp @@ -124,6 +124,9 @@ #ifndef EXTERN_C #define EXTERN_C extern "C" #endif + + #define offsetofclass(base, derived) ((DWORD_PTR)(static_cast((derived*)_ATL_PACKING))-_ATL_PACKING) + #else #ifndef EXTERN_C #define EXTERN_C extern diff --git a/include/util/filedef.hpp b/include/util/filedef.hpp index 8a5f4a29f26d8b02ce7e96b5549bc3a7a0ea55f8..71ed0e8d5c5da7b56f88436f7b3400eab5254a20 100644 --- a/include/util/filedef.hpp +++ b/include/util/filedef.hpp @@ -5,8 +5,12 @@ #if (TARGET_OS == OS_WINDOWS) typedef HANDLE os_fd_t; + #define FILE_HANDLE HANDLE + #define FILE_INVALID INVALID_HANDLE_VALUE #elif (TARGET_OS == OS_POSIX) typedef int os_fd_t; + #define FILE_HANDLE int + #define FILE_INVALID (int) -1 #endif diff --git a/include/util/locksection.hpp b/include/util/locksection.hpp index 0a9805285bc30a461e7baa260d31a93e817d305f..fa4100bd7eb9d92668103b573aa42b904a41c6bc 100644 --- a/include/util/locksection.hpp +++ b/include/util/locksection.hpp @@ -12,13 +12,11 @@ #if (TARGET_OS == OS_WINDOWS) - typedef HANDLE os_fd_t; typedef int os_pid_t; typedef HANDLE os_thread_t; typedef HANDLE os_sem_t; typedef CRITICAL_SECTION os_mutex_t; #elif (TARGET_OS == OS_POSIX) - typedef int os_fd_t; typedef pid_t os_pid_t; typedef pthread_t os_thread_t; typedef sem_t os_sem_t; diff --git a/include/util/posix/osdef.h b/include/util/posix/osdef.h index 5b53e951f4253fd8501c1e816bba00024ac5088a..25b58b091bd687d54b81ac652c2721c0e4c4195d 100644 --- a/include/util/posix/osdef.h +++ b/include/util/posix/osdef.h @@ -15,8 +15,8 @@ #include -#define byint64 long long int -#define byuint64 unsigned long long int +#define os_int64 long long int +#define os_uint64 unsigned long long int #define FMT_I64D "%lld" #define FMT_I64U "%llu" diff --git a/include/util/win/osdef.h b/include/util/win/osdef.h index 3ed70039da6f9821aeaaf40691c4abb73d4decfa..1f9e5e4e3afe5215b046ee79c60072e17d26fd00 100644 --- a/include/util/win/osdef.h +++ b/include/util/win/osdef.h @@ -6,8 +6,8 @@ #include #pragma warning(disable:4996) -#define byint64 __int64 -#define byuint64 unsigned __int64 +#define os_int64 __int64 +#define os_uint64 unsigned __int64 #define FMT_I64D "%I64d" #define FMT_I64U "%I64u" diff --git a/infoanalysis/infoanalysisimpl.cpp b/infoanalysis/infoanalysisimpl.cpp index 57e8d073bb208dffe46b4ed259b21603707b62c7..8dee7350694e53d0635ed0832b8e96d007289b56 100644 --- a/infoanalysis/infoanalysisimpl.cpp +++ b/infoanalysis/infoanalysisimpl.cpp @@ -13,7 +13,7 @@ CInfoAnalysisImpl::~CInfoAnalysisImpl(void) } ////////////////////////////////////////////////////////////////////////// -std_method_impl CInfoAnalysisImpl::init_class(IModuleBase* prot, IModuleBase* punkOuter) +std_method_impl CInfoAnalysisImpl::init_class(IBase* prot, IBase* punkOuter) { if (prot != NULL) { @@ -42,18 +42,15 @@ std_method_impl CInfoAnalysisImpl::Stop() } ////////////////////////////////////////////////////////////////////////// -std_method_impl CInfoAnalysisImpl::NewObject(const char* data, IModuleBase** ioNodeInfo) +std_method_impl CInfoAnalysisImpl::NewObject(const char* data, IBase** ioNodeInfo) { InfoRoot* pObject = NULL; pObject = new CRootImpl(); - pObject->LoadData((char*)data); - pObject->AddRef(); - *ioNodeInfo = reinterpret_cast(pObject); - + pObject->QueryInterface(_uuidof(IBase), (void**)ioNodeInfo); return S_OK; } -std_method_impl CInfoAnalysisImpl::NewLoadFileObject(const TCHAR* filepath, IModuleBase** ioNodeInfo) +std_method_impl CInfoAnalysisImpl::NewLoadFileObject(const TCHAR* filepath, IBase** ioNodeInfo) { HRESULT hr = S_OK; @@ -61,17 +58,17 @@ std_method_impl CInfoAnalysisImpl::NewLoadFileObject(const TCHAR* filepath, IMod retrtpv(filepath, E_FAIL); retrtpv(ioNodeInfo, E_FAIL); CComLoader comLoader; - _lComPtr pAsynIo = INULL; - IReadFile* pReadFile = NULL; + _lComPtr pAsynIo = INULL; + _lComPtr pReadFile = INULL; if (m_pRot != INULL) { - m_pRot->GetObject(CLSID_IAsynIo, re_uuidof(IAsynIo), (IModuleBase**)&pAsynIo.m_p); + m_pRot->GetObject(CLSID_IAsynIo, _uuidof(IAsynIo), (IBase**)&pAsynIo.m_p); } if (pAsynIo != NULL) { - pAsynIo->CreateReadFile(&pReadFile); + pAsynIo->CreateReadFile((IBase**)&pReadFile.m_p); } else { @@ -96,45 +93,39 @@ std_method_impl CInfoAnalysisImpl::NewLoadFileObject(const TCHAR* filepath, IMod { return E_FAIL; } - hr = comLoader.CreateInstance(CLSID_IAsynIo, NULL, NULL, re_uuidof(IAsynIo), (void**)&pAsynIo.m_p); + hr = comLoader.CreateInstance(CLSID_IAsynIo, NULL, NULL, _uuidof(IAsynIo), (void**)&pAsynIo.m_p); if (hr == S_OK) { - pAsynIo->CreateReadFile(&pReadFile); + pAsynIo->CreateReadFile((IBase**)&pReadFile.m_p); } else { return E_FAIL; } } - retrtpv(pReadFile, E_FAIL) + retrtpv(pReadFile.m_p, E_FAIL) retrtpv(FileIsExist(filepath), E_FAIL) hr = pReadFile->LoadFile(filepath, 0, 0, 0, 0); - byint64 ulFileSize = pReadFile->GetFileSize(); + os_int64 ulFileSize = pReadFile->GetFileSize(); retrtpv(ulFileSize, E_FAIL) sentry pBuffer; pBuffer = Memory_Allocate char[ulFileSize + 1]; - - - byint64 ulReadLen = -1; + os_int64 ulReadLen = -1; pReadFile->ReadBuffer(pBuffer, ulFileSize, &ulReadLen); pReadFile->CloseFile(); InfoRoot* pObject = new CRootImpl(); pObject->LoadData((char*)pBuffer.m_p); - pObject->AddRef(); - - *ioNodeInfo = reinterpret_cast(pObject); - - pAsynIo->DeleteIo(pReadFile); + pObject->QueryInterface(_uuidof(IBase),(void**)ioNodeInfo); return S_OK; } -std_method_impl CInfoAnalysisImpl::DelObject(IModuleBase* ioNodeInfo) +std_method_impl CInfoAnalysisImpl::DelObject(IBase* ioNodeInfo) { if (ioNodeInfo != INULL) diff --git a/infoanalysis/infoanalysisimpl.h b/infoanalysis/infoanalysisimpl.h index df0f3584eb4ad140e37659d28c6db9c007a04670..2a832d18528cd1ffe78f4386e0f336a1c0e3d5b0 100644 --- a/infoanalysis/infoanalysisimpl.h +++ b/infoanalysis/infoanalysisimpl.h @@ -11,8 +11,8 @@ class CInfoAnalysisImpl : public IInfoAnalysis, public IDataJsonToXML, - public IMdPlugin, - public IMdPluginRun, + public IPlugin, + public IPluginRun, public CUnknownImp { public: @@ -20,11 +20,11 @@ public: ~CInfoAnalysisImpl(void); - UNKNOWN_IMP4_(IMdPlugin, IMdPluginRun,IInfoAnalysis,IDataJsonToXML); + UNKNOWN_IMP4_(IPlugin, IPluginRun,IInfoAnalysis,IDataJsonToXML); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// - std_method_impl init_class(IModuleBase* prot, IModuleBase* punkOuter); + std_method_impl init_class(IBase* prot, IBase* punkOuter); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -37,9 +37,9 @@ public: std_method(Stop)(); ////////////////////////////////////////////////////////////////////////// - std_method(NewObject)(const char* data, IModuleBase** ioNodeInfo); - std_method(NewLoadFileObject)(const TCHAR* filepath, IModuleBase** ioNodeInfo); - std_method(DelObject)(IModuleBase* ioNodeInfo); + std_method(NewObject)(const char* data, IBase** ioNodeInfo); + std_method(NewLoadFileObject)(const TCHAR* filepath, IBase** ioNodeInfo); + std_method(DelObject)(IBase* ioNodeInfo); ////////////////////////////////////////////////////////////////////////// std_method(JsonToXML)(const char* input, char* output, unsigned long ulen); std_method(XMLToJson)(const char* input, char* output, unsigned long ulen); diff --git a/main/main.cpp b/main/main.cpp index 18cb5ff6469cd9799ee77fe552e32fb3ba4cbe6a..f820344d7c814d8ec6f4ba84e1fdc1d07190701d 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -25,7 +25,7 @@ int WINAPI WinMain( HINSTANCE hInstance, BOOL bRet = loader.LoadCom(stringcomenv.c_str()); if (bRet == TRUE) - loader.CreateInstance(CLSID_ComEnv,NULL,NULL,re_uuidof(IComEnv),(void**)&pIComEnv.m_p); + loader.CreateInstance(CLSID_ComEnv,NULL,NULL,_uuidof(IComEnv),(void**)&pIComEnv.m_p); if (pIComEnv.m_p != NULL) { diff --git a/mainui.sln b/mainui.sln index 00dcf54b33ac667b1e7ef2350cc55608732fe041..1a53ce588f754e58c393d162286ca9152017deba 100644 --- a/mainui.sln +++ b/mainui.sln @@ -9,16 +9,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "infoanalysis", "InfoAnalysi EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asynIo", "asynio\AsynIo.vcxproj", "{989A9A35-8FEE-4932-82C9-E43CC573594E}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "adapterpy", "adapterpy\adapterpy.vcxproj", "{97F6418A-F7A8-4C57-8D0F-93C8E9BDA4A2}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sshchannel", "sshchannel\sshchannel.vcxproj", "{EFE5CA56-D7F7-49F4-B1A2-1374E80FB60C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "adapters", "adapters\adapters.vcxproj", "{C27706C1-EDB8-4050-9E3D-155E2CCD2121}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "adapterjs", "adapterjs\adapterjs.vcxproj", "{DDCA9970-5DE8-4318-935B-6781CDF01583}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "adapterlua", "adapterlua\adapterlua.vcxproj", "{AB4B3FFB-7301-40AE-BF1E-14C50A40DB13}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "main", "main\mainui.vcxproj", "{44AC7B48-D81E-4C78-A881-A15C69256C72}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mempool", "mempool\mempool.vcxproj", "{4DADD130-5D03-4B60-8A45-9D6C725A6043}" @@ -49,12 +43,6 @@ Global {989A9A35-8FEE-4932-82C9-E43CC573594E}.Release|Win32.ActiveCfg = Release|Win32 {989A9A35-8FEE-4932-82C9-E43CC573594E}.Release|Win32.Build.0 = Release|Win32 {989A9A35-8FEE-4932-82C9-E43CC573594E}.Release|x64.ActiveCfg = Release|Win32 - {97F6418A-F7A8-4C57-8D0F-93C8E9BDA4A2}.Debug|Win32.ActiveCfg = Debug|Win32 - {97F6418A-F7A8-4C57-8D0F-93C8E9BDA4A2}.Debug|Win32.Build.0 = Debug|Win32 - {97F6418A-F7A8-4C57-8D0F-93C8E9BDA4A2}.Debug|x64.ActiveCfg = Debug|Win32 - {97F6418A-F7A8-4C57-8D0F-93C8E9BDA4A2}.Release|Win32.ActiveCfg = Release|Win32 - {97F6418A-F7A8-4C57-8D0F-93C8E9BDA4A2}.Release|Win32.Build.0 = Release|Win32 - {97F6418A-F7A8-4C57-8D0F-93C8E9BDA4A2}.Release|x64.ActiveCfg = Release|Win32 {EFE5CA56-D7F7-49F4-B1A2-1374E80FB60C}.Debug|Win32.ActiveCfg = Debug|Win32 {EFE5CA56-D7F7-49F4-B1A2-1374E80FB60C}.Debug|Win32.Build.0 = Debug|Win32 {EFE5CA56-D7F7-49F4-B1A2-1374E80FB60C}.Debug|x64.ActiveCfg = Debug|Win32 @@ -67,18 +55,6 @@ Global {C27706C1-EDB8-4050-9E3D-155E2CCD2121}.Release|Win32.ActiveCfg = Release|Win32 {C27706C1-EDB8-4050-9E3D-155E2CCD2121}.Release|Win32.Build.0 = Release|Win32 {C27706C1-EDB8-4050-9E3D-155E2CCD2121}.Release|x64.ActiveCfg = Release|Win32 - {DDCA9970-5DE8-4318-935B-6781CDF01583}.Debug|Win32.ActiveCfg = Debug|Win32 - {DDCA9970-5DE8-4318-935B-6781CDF01583}.Debug|Win32.Build.0 = Debug|Win32 - {DDCA9970-5DE8-4318-935B-6781CDF01583}.Debug|x64.ActiveCfg = Debug|Win32 - {DDCA9970-5DE8-4318-935B-6781CDF01583}.Release|Win32.ActiveCfg = Release|Win32 - {DDCA9970-5DE8-4318-935B-6781CDF01583}.Release|Win32.Build.0 = Release|Win32 - {DDCA9970-5DE8-4318-935B-6781CDF01583}.Release|x64.ActiveCfg = Release|Win32 - {AB4B3FFB-7301-40AE-BF1E-14C50A40DB13}.Debug|Win32.ActiveCfg = Debug|Win32 - {AB4B3FFB-7301-40AE-BF1E-14C50A40DB13}.Debug|Win32.Build.0 = Debug|Win32 - {AB4B3FFB-7301-40AE-BF1E-14C50A40DB13}.Debug|x64.ActiveCfg = Debug|Win32 - {AB4B3FFB-7301-40AE-BF1E-14C50A40DB13}.Release|Win32.ActiveCfg = Release|Win32 - {AB4B3FFB-7301-40AE-BF1E-14C50A40DB13}.Release|Win32.Build.0 = Release|Win32 - {AB4B3FFB-7301-40AE-BF1E-14C50A40DB13}.Release|x64.ActiveCfg = Release|Win32 {44AC7B48-D81E-4C78-A881-A15C69256C72}.Debug|Win32.ActiveCfg = Debug|Win32 {44AC7B48-D81E-4C78-A881-A15C69256C72}.Debug|Win32.Build.0 = Debug|Win32 {44AC7B48-D81E-4C78-A881-A15C69256C72}.Debug|x64.ActiveCfg = Debug|Win32 diff --git a/mempool/mempoolimpl.cpp b/mempool/mempoolimpl.cpp index 5c3026140a0d979983d5745790d82ea90a51ebf3..1c88257e60a962d0773c936dae1e4bb4b9e88b8e 100644 --- a/mempool/mempoolimpl.cpp +++ b/mempool/mempoolimpl.cpp @@ -8,7 +8,7 @@ CMemPoolImpl::~CMemPoolImpl(void) { } ////////////////////////////////////////////////////////////////////////// -std_method_impl CMemPoolImpl::init_class(IModuleBase* prot, IModuleBase* punkOuter) +std_method_impl CMemPoolImpl::init_class(IBase* prot, IBase* punkOuter) { HRESULT hr = S_OK; if (prot != NULL) diff --git a/mempool/mempoolimpl.h b/mempool/mempoolimpl.h index 7adbeb6c2a999d5c890bece39cc63273551d809d..82dc1d2107a28bd9118747544726eab95228d23a 100644 --- a/mempool/mempoolimpl.h +++ b/mempool/mempoolimpl.h @@ -6,8 +6,8 @@ #include class CMemPoolImpl : public IMemPool, - public IMdPlugin, - public IMdPluginRun, + public IPlugin, + public IPluginRun, public CUnknownImp { public: @@ -15,11 +15,11 @@ public: virtual ~CMemPoolImpl(void); - UNKNOWN_IMP3_(IMdPlugin, IMdPluginRun,IMemPool); + UNKNOWN_IMP3_(IPlugin, IPluginRun,IMemPool); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// - std_method_impl init_class(IModuleBase* prot, IModuleBase* punkOuter); + std_method_impl init_class(IBase* prot, IBase* punkOuter); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// diff --git a/plugin/mainviewimpl.cpp b/plugin/mainviewimpl.cpp index a3feeed4028ade078184775be6ba5c2d5f45c70a..fa479b7ea93cf79635e6b737c2db267dbb19fc87 100644 --- a/plugin/mainviewimpl.cpp +++ b/plugin/mainviewimpl.cpp @@ -12,7 +12,7 @@ mainviewimpl::~mainviewimpl() } ////////////////////////////////////////////////////////////////////////// -DOCALLMETHODIMP mainviewimpl::init_class(IModuleBase* prot, IModuleBase* punkOuter) +DOCALLMETHODIMP mainviewimpl::init_class(IBase* prot, IBase* punkOuter) { DOCALLRESULT hr = S_OK; if (prot != NULL) diff --git a/plugin/mainviewimpl.h b/plugin/mainviewimpl.h index 159409e5d9149f769f3ef9e44b38b649fa0e410a..ecd407e3ac9ef5b4fd0c2319244035d74e567770 100644 --- a/plugin/mainviewimpl.h +++ b/plugin/mainviewimpl.h @@ -7,19 +7,19 @@ class mainviewimpl : public IView, - public IMdPlugin, - public IMdPluginRun, + public IPlugin, + public IPluginRun, public CUnknownImp { public: mainviewimpl(); ~mainviewimpl(); - UNKNOWN_IMP3_(IMdPlugin, IMdPluginRun, IView); + UNKNOWN_IMP3_(IPlugin, IPluginRun, IView); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// - DOCALLMETHODIMP init_class(IModuleBase* prot, IModuleBase* punkOuter); + DOCALLMETHODIMP init_class(IBase* prot, IBase* punkOuter); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// diff --git a/sshchannel/sshchannelimpl.cpp b/sshchannel/sshchannelimpl.cpp index 18356dc4a0c9f1ed187b6e92bb7371d04a87a762..a831acce1898034246eeeeeb09930b0b453346b3 100644 --- a/sshchannel/sshchannelimpl.cpp +++ b/sshchannel/sshchannelimpl.cpp @@ -9,7 +9,7 @@ CSshChannelImpl::~CSshChannelImpl(void) { } ////////////////////////////////////////////////////////////////////////// -std_method_impl CSshChannelImpl::init_class(IModuleBase* prot, IModuleBase* punkOuter) +std_method_impl CSshChannelImpl::init_class(IBase* prot, IBase* punkOuter) { HRESULT hr = S_OK; if (prot != NULL) @@ -35,7 +35,7 @@ std_method_impl CSshChannelImpl::Start() { HRESULT hr = S_OK; - m_pRot->GetObject(CLSID_IAsynIo,re_uuidof(IAsynIo),(IModuleBase**)&m_pIAsynIo.m_p); + m_pRot->GetObject(CLSID_IAsynIo,_uuidof(IAsynIo),(IBase**)&m_pIAsynIo.m_p); retrtpv(m_pIAsynIo,E_FAIL) return hr; @@ -53,19 +53,11 @@ std_method_type_impl(sshid) CSshChannelImpl::CreateSshChannel() { retrtpv(m_pIAsynIo,E_FAIL) ITcpSocket* pSock = NULL; - HRESULT hr = m_pIAsynIo->CreateTcpSocket(&pSock); - RFAILEDV(hr,-1) - retrtpv(pSock,-1) - pSock->CreateSocket(); - m_mapSschannel[pSock->GetSocket()] = pSock; return pSock->GetSocket(); } std_method_impl CSshChannelImpl::CloseChannel(sshid id) -{ - MapChannel::iterator it = m_mapSschannel.find(id); - retrtpv(it != m_mapSschannel.end(),E_FAIL) - m_mapSschannel.erase(id); - return (*it).second->CloseSocket(); +{; + return S_OK; } std_method_type_impl(ssize_t) CSshChannelImpl::SendChannel(sshid id,char* buf,size_t len) { diff --git a/sshchannel/sshchannelimpl.h b/sshchannel/sshchannelimpl.h index e0648416ca5c1d2a06d7a328a39fef21448674f1..339daadb798576588720e15f0aa09ee1ac16b1a4 100644 --- a/sshchannel/sshchannelimpl.h +++ b/sshchannel/sshchannelimpl.h @@ -7,19 +7,19 @@ #include class CSshChannelImpl : public ISshChannel, - public IMdPlugin, - public IMdPluginRun, + public IPlugin, + public IPluginRun, public CUnknownImp { public: CSshChannelImpl(void); virtual ~CSshChannelImpl(void); - UNKNOWN_IMP3_(IMdPlugin, IMdPluginRun,ISshChannel); + UNKNOWN_IMP3_(IPlugin, IPluginRun,ISshChannel); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// - std_method_impl init_class(IModuleBase* prot, IModuleBase* punkOuter); + std_method_impl init_class(IBase* prot, IBase* punkOuter); ////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////