├── BoxLib ├── BArguments.cpp ├── BArguments.h ├── BBrowserCaps.cpp ├── BBrowserCaps.h ├── BCipher.cpp ├── BCipher.h ├── BClassRegistry.cpp ├── BClassRegistry.h ├── BCodePage.cpp ├── BCodePage.h ├── BCollection.h ├── BComm.cpp ├── BComm.h ├── BConsole.cpp ├── BConsole.h ├── BCookie.cpp ├── BCookie.h ├── BDatabase.cpp ├── BDatabase.h ├── BDate.cpp ├── BDate.h ├── BDictionary.cpp ├── BDictionary.h ├── BDirectory.cpp ├── BDirectory.h ├── BECC.cpp ├── BECC.h ├── BEncoding.cpp ├── BEncoding.h ├── BErrorTrace.cpp ├── BErrorTrace.h ├── BFile.cpp ├── BFile.h ├── BFileSystem.cpp ├── BFileSystem.h ├── BFolderDictionary.cpp ├── BFolderDictionary.h ├── BGDI.cpp ├── BGDI.h ├── BHash.cpp ├── BHash.h ├── BHook.cpp ├── BHook.h ├── BHtmlWindow.cpp ├── BHtmlWindow.h ├── BHttpRequest.cpp ├── BHttpRequest.h ├── BIdentity.cpp ├── BIdentity.h ├── BInterlock.cpp ├── BList.cpp ├── BList.h ├── BListEx.cpp ├── BListEx.h ├── BMStream.cpp ├── BMStream.h ├── BMemStream.h ├── BMessageManager.cpp ├── BMessageManager.h ├── BNoUrl.cpp ├── BPath.h ├── BPipe.cpp ├── BPipe.h ├── BPipeLine.cpp ├── BPipeLine.h ├── BProcess.cpp ├── BProcess.h ├── BQueue.cpp ├── BQueue.h ├── BRSA.cpp ├── BRSA.h ├── BRandom.cpp ├── BRandom.h ├── BRecordset.cpp ├── BRecordset.h ├── BRegExp.cpp ├── BRegExp.h ├── BRequestDictionary.cpp ├── BRequestDictionary.h ├── BShellLink.cpp ├── BShellLink.h ├── BSimpleDictionary.cpp ├── BSimpleDictionary.h ├── BStorage.cpp ├── BStorage.h ├── BStream.cpp ├── BStream.h ├── BStruct.cpp ├── BStruct.h ├── BSysInfo.cpp ├── BSysInfo.h ├── BThread.cpp ├── BThread.h ├── BTypeInfo.cpp ├── BUDPSocket.cpp ├── BUDPSocket.h ├── BUrlStream.cpp ├── BUrlStream.h ├── BVarType.h ├── BVariant.cpp ├── BVariant.h ├── BWindow.cpp ├── BWindow.h ├── BoxLib.h ├── BoxLib.idl ├── BoxLib.vcproj ├── BoxLib.vcproj.vspscc ├── JSONWriter.cpp ├── JSON_load.cpp ├── ReadMe.txt ├── SQLite │ ├── sqlite3.c │ └── sqlite3.h ├── blib.cpp ├── crc16.h ├── dispcall.cpp ├── fmtHTML │ ├── fmtHTML.cpp │ ├── fmtHTML.h │ ├── fmtHTML.lex │ └── fmtlex.cpp ├── jpeg │ ├── jcapimin.c │ ├── jcapistd.c │ ├── jccoefct.c │ ├── jccolor.c │ ├── jcdctmgr.c │ ├── jchuff.c │ ├── jchuff.h │ ├── jcinit.c │ ├── jcmainct.c │ ├── jcmarker.c │ ├── jcmaster.c │ ├── jcomapi.c │ ├── jconfig.h │ ├── jcparam.c │ ├── jcphuff.c │ ├── jcprepct.c │ ├── jcsample.c │ ├── jctrans.c │ ├── jdapimin.c │ ├── jdapistd.c │ ├── jdatadst.c │ ├── jdatasrc.c │ ├── jdcoefct.c │ ├── jdcolor.c │ ├── jdct.h │ ├── jddctmgr.c │ ├── jdhuff.c │ ├── jdhuff.h │ ├── jdinput.c │ ├── jdmainct.c │ ├── jdmarker.c │ ├── jdmaster.c │ ├── jdmerge.c │ ├── jdphuff.c │ ├── jdpostct.c │ ├── jdsample.c │ ├── jdtrans.c │ ├── jerror.c │ ├── jerror.h │ ├── jfdctflt.c │ ├── jfdctfst.c │ ├── jfdctint.c │ ├── jidctflt.c │ ├── jidctfst.c │ ├── jidctint.c │ ├── jidctred.c │ ├── jinclude.h │ ├── jmemmgr.c │ ├── jmemnobs.c │ ├── jmemsys.h │ ├── jmorecfg.h │ ├── jpegint.h │ ├── jpeglib.h │ ├── jquant1.c │ ├── jquant2.c │ ├── jutils.c │ └── jversion.h ├── json.h ├── libpng │ ├── png.c │ ├── png.h │ ├── pngconf.h │ ├── pngerror.c │ ├── pngget.c │ ├── pngmem.c │ ├── pngpread.c │ ├── pngread.c │ ├── pngrio.c │ ├── pngrtran.c │ ├── pngrutil.c │ ├── pngset.c │ ├── pngtrans.c │ ├── pngvcrd.c │ ├── pngwio.c │ ├── pngwrite.c │ ├── pngwtran.c │ └── pngwutil.c ├── mng │ ├── libmng.h │ ├── libmng_callback_xs.c │ ├── libmng_chunk_io.c │ ├── libmng_chunk_io.h │ ├── libmng_chunk_prc.c │ ├── libmng_chunk_prc.h │ ├── libmng_chunk_xs.c │ ├── libmng_chunks.h │ ├── libmng_cms.c │ ├── libmng_cms.h │ ├── libmng_conf.h │ ├── libmng_data.h │ ├── libmng_display.c │ ├── libmng_display.h │ ├── libmng_dither.c │ ├── libmng_dither.h │ ├── libmng_error.c │ ├── libmng_error.h │ ├── libmng_filter.c │ ├── libmng_filter.h │ ├── libmng_hlapi.c │ ├── libmng_jpeg.c │ ├── libmng_jpeg.h │ ├── libmng_memory.h │ ├── libmng_object_prc.c │ ├── libmng_object_prc.h │ ├── libmng_objects.h │ ├── libmng_pixels.c │ ├── libmng_pixels.h │ ├── libmng_prop_xs.c │ ├── libmng_read.c │ ├── libmng_read.h │ ├── libmng_trace.c │ ├── libmng_trace.h │ ├── libmng_types.h │ ├── libmng_write.c │ ├── libmng_write.h │ ├── libmng_zlib.c │ └── libmng_zlib.h ├── msado15.tlh ├── msado15.tli ├── png │ ├── png.c │ ├── png.h │ ├── pngconf.h │ ├── pngerror.c │ ├── pngget.c │ ├── pngmem.c │ ├── pngpread.c │ ├── pngread.c │ ├── pngrio.c │ ├── pngrtran.c │ ├── pngrutil.c │ ├── pngset.c │ ├── pngtrans.c │ ├── pngvcrd.c │ ├── pngwio.c │ ├── pngwrite.c │ ├── pngwtran.c │ └── pngwutil.c ├── stdafx.cpp ├── stdafx.h ├── typelib │ ├── ti.h │ ├── tiIArguments.cpp │ ├── tiIBaseStorage.cpp │ ├── tiIBaseStream.cpp │ ├── tiIBrowserCap.cpp │ ├── tiICipher.cpp │ ├── tiICommStream.cpp │ ├── tiIConsole.cpp │ ├── tiIDatabase.cpp │ ├── tiIECC.cpp │ ├── tiIEncoding.cpp │ ├── tiIErrorTrace.cpp │ ├── tiIFile.cpp │ ├── tiIFileStream.cpp │ ├── tiIFileSystem.cpp │ ├── tiIFolder.cpp │ ├── tiIHTWindow.cpp │ ├── tiIHash.cpp │ ├── tiIHttpRequest.cpp │ ├── tiIIdentity.cpp │ ├── tiIMatch.cpp │ ├── tiIMessageColl.cpp │ ├── tiIMessageManager.cpp │ ├── tiIPackage.cpp │ ├── tiIPipe.cpp │ ├── tiIPipeLine.cpp │ ├── tiIProcess.cpp │ ├── tiIQueue.cpp │ ├── tiIRSA.cpp │ ├── tiIRSField.cpp │ ├── tiIRandom.cpp │ ├── tiIReadCookie.cpp │ ├── tiIRecordset.cpp │ ├── tiIRegExp.cpp │ ├── tiIRequestDictionary.cpp │ ├── tiIShellLink.cpp │ ├── tiISimpleDictionary.cpp │ ├── tiIStorageItem.cpp │ ├── tiIStringList.cpp │ ├── tiISubMatch.cpp │ ├── tiISysInfo.cpp │ ├── tiIUDPPacket.cpp │ ├── tiIUDPSocket.cpp │ ├── tiIUploadData.cpp │ ├── tiIUploadList.cpp │ ├── tiIVariantDictionary.cpp │ ├── tiIVariantDirectory.cpp │ ├── tiIVariantList.cpp │ ├── tiIVariantListEx.cpp │ ├── tiIVariantStruct.cpp │ ├── tiIWindow.cpp │ └── tiIWriteCookie.cpp └── zlib │ ├── adler32.c │ ├── compress.c │ ├── crc32.c │ ├── crc32.h │ ├── deflate.c │ ├── deflate.h │ ├── gzio.c │ ├── inffast.c │ ├── inffast.h │ ├── inffixed.h │ ├── inflate.c │ ├── inflate.h │ ├── inftrees.c │ ├── inftrees.h │ ├── trees.c │ ├── trees.h │ ├── uncompr.c │ ├── zconf.h │ ├── zlib.h │ ├── zutil.c │ └── zutil.h ├── Console模式编译.txt ├── LICENSE ├── NBR ├── BuildBtn.cpp ├── BuildBtn.h ├── CertInfo.cpp ├── CertInfo.h ├── CertView.cpp ├── CertView.h ├── DlgLang.cpp ├── DlgLang.h ├── LogDialog.cpp ├── LogDialog.h ├── Logon.cpp ├── Logon.h ├── NBR.cpp ├── NBR.h ├── NBR.rc ├── NBR.vcproj ├── NBR.vcproj.vspscc ├── NBRDlg.cpp ├── NBRDlg.h ├── ReadMe.txt ├── SiDlg.cpp ├── SiDlg.h ├── Worker.cpp ├── Worker.h ├── ZipFile.cpp ├── ZipFile.h ├── res │ ├── NBR.ico │ ├── NBR.manifest │ ├── NBR.rc2 │ ├── build.bmp │ ├── icon1.ico │ ├── logo.bmp │ ├── name.bmp │ ├── nbFile.ico │ ├── nbLib.ico │ ├── pbnb.bmp │ └── title.bmp ├── resource.h ├── stdafx.cpp └── stdafx.h ├── NetBox.txt ├── NetBox2 ├── BoxApplication.cpp ├── BoxApplication.h ├── BoxArguments.cpp ├── BoxArguments.h ├── BoxArray.h ├── BoxBinPtr.h ├── BoxCacheNode.h ├── BoxCachePool.cpp ├── BoxCachePool.h ├── BoxCommand.cpp ├── BoxCommand.h ├── BoxConsole.cpp ├── BoxConsole.h ├── BoxContents.cpp ├── BoxContents.h ├── BoxDES.cpp ├── BoxDES.h ├── BoxDictEnum.cpp ├── BoxDictEnum.h ├── BoxDictionary.cpp ├── BoxDictionary.h ├── BoxEncoding.cpp ├── BoxEncoding.h ├── BoxFactory.cpp ├── BoxFactory.h ├── BoxFile.cpp ├── BoxFile.h ├── BoxFixString.h ├── BoxHttpAccept.cpp ├── BoxHttpAccept.h ├── BoxHttpContext.cpp ├── BoxHttpContext.h ├── BoxHttpCookies.cpp ├── BoxHttpCookies.h ├── BoxHttpHost.cpp ├── BoxHttpHost.h ├── BoxHttpRequest.cpp ├── BoxHttpRequest.h ├── BoxHttpResponse.cpp ├── BoxHttpResponse.h ├── BoxHttpScript.cpp ├── BoxHttpScript.h ├── BoxHttpServer.cpp ├── BoxHttpServer.h ├── BoxHttpSession.cpp ├── BoxHttpSession.h ├── BoxJobServer.cpp ├── BoxJobServer.h ├── BoxLRUCache.h ├── BoxLink.h ├── BoxMemFile.h ├── BoxMemStream.h ├── BoxObject.h ├── BoxPath.h ├── BoxPipe.cpp ├── BoxPipe.h ├── BoxProtocol.cpp ├── BoxProtocol.h ├── BoxRSA.cpp ├── BoxRSA.h ├── BoxSafeObject.cpp ├── BoxSafeObject.h ├── BoxScript.cpp ├── BoxScript.h ├── BoxScriptContext.cpp ├── BoxScriptContext.h ├── BoxScriptError.cpp ├── BoxScriptError.h ├── BoxScriptObject.cpp ├── BoxScriptObject.h ├── BoxService.cpp ├── BoxService.h ├── BoxSimpleXml.cpp ├── BoxSimpleXml.h ├── BoxSmtp.cpp ├── BoxSmtp.h ├── BoxSocket.cpp ├── BoxSocket.h ├── BoxStream.cpp ├── BoxStream.h ├── BoxString.cpp ├── BoxString.h ├── BoxSysInfo.cpp ├── BoxSysInfo.h ├── BoxSysInfo1.cpp ├── BoxSystem.cpp ├── BoxSystem.h ├── BoxTcpServer.cpp ├── BoxTcpServer.h ├── BoxTimeCache.cpp ├── BoxTimeCache.h ├── BoxZipFile.cpp ├── BoxZipFile.h ├── MemoryModule.cpp ├── MemoryModule.h ├── NetBox.ico ├── NetBox.manifest ├── NetBox2.cpp ├── NetBox2.h ├── NetBox2.rc ├── NetBox2.sln ├── NetBox2.vcproj ├── NetBox2.vcproj.vspscc ├── NetBox2.vsscc ├── NetBox2.vssscc ├── PubFun.cpp ├── ReadMe.txt ├── SSLConnect.h ├── SSLContext.h ├── ScriptHost.cpp ├── ScriptHost.h ├── X509Certificate.h ├── ZipFile.cpp ├── ZipFile.h ├── activdbg.h ├── bin1.bin ├── msg.bin ├── nbFile.ico ├── resource.h ├── sice.h ├── small.ico ├── stdafx.cpp └── stdafx.h ├── README.md └── 新建BoxLib对象.txt /BoxLib/BArguments.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "BArguments.h" 3 | 4 | STDMETHODIMP CBArguments::get_Default(VARIANT *pVariantReturn) 5 | { 6 | pVariantReturn->bstrVal = m_strCmdLine.AllocSysString(); 7 | pVariantReturn->vt = VT_BSTR; 8 | 9 | return S_OK; 10 | } 11 | 12 | STDMETHODIMP CBArguments::get_CommandLine(BSTR* newVal) 13 | { 14 | *newVal = m_strCmdLine.AllocSysString(); 15 | return S_OK; 16 | } 17 | 18 | STDMETHODIMP CBArguments::put_CommandLine(BSTR newVal) 19 | { 20 | m_strCmdLine = newVal; 21 | 22 | LPCWSTR pstr; 23 | BOOL bIsLong; 24 | 25 | RemoveAll(); 26 | 27 | while(newVal && *newVal) 28 | { 29 | while(iswspace(*newVal)) 30 | newVal ++; 31 | 32 | if(bIsLong = (*newVal == '\"')) 33 | newVal ++; 34 | 35 | pstr = newVal; 36 | 37 | if(bIsLong) 38 | while(*newVal != 0 && *newVal != '\"') 39 | newVal ++; 40 | else 41 | while(*newVal != 0 && !iswspace(*newVal)) 42 | newVal ++; 43 | 44 | if(newVal != pstr) 45 | { 46 | CBString str; 47 | 48 | str.SetString(pstr, (int)(newVal - pstr)); 49 | AddValue(str); 50 | } 51 | 52 | if(bIsLong && *newVal == '\"') 53 | newVal ++; 54 | } 55 | 56 | return S_OK; 57 | } 58 | 59 | -------------------------------------------------------------------------------- /BoxLib/BArguments.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BList.h" 4 | 5 | class __declspec(uuid("94650000-0000-0041-7267-756D656E7473")) 6 | CBArguments : public CBDispatch 7 | { 8 | DECLARE_CLASS_EX(CBArguments, CBList) 9 | 10 | public: 11 | STDMETHOD(get_Default)(VARIANT *pVariantReturn); 12 | 13 | public: 14 | STDMETHOD(get_CommandLine)(BSTR* newVal); 15 | STDMETHOD(put_CommandLine)(BSTR newVal); 16 | 17 | private: 18 | CBString m_strCmdLine; 19 | }; 20 | 21 | -------------------------------------------------------------------------------- /BoxLib/BCipher.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class __declspec(uuid("94650000-0000-0000-0000-436970686572")) 6 | CBCipher : public CBDispatch 7 | { 8 | DECLARE_CLASS(CBCipher) 9 | 10 | public: 11 | CBCipher(void); 12 | ~CBCipher(void); 13 | 14 | public: 15 | // ICipher 16 | STDMETHOD(get__NewEnum)(IUnknown** ppEnumReturn); 17 | STDMETHOD(get_Name)(BSTR *pVal); 18 | STDMETHOD(get_BlockSize)(short *pVal); 19 | STDMETHOD(get_CipherMode)(short *pVal); 20 | STDMETHOD(get_KeySize)(short *pVal); 21 | STDMETHOD(get_Key)(VARIANT *pVal); 22 | STDMETHOD(put_Key)(VARIANT Val); 23 | STDMETHOD(GenerateKey)(short iSize); 24 | STDMETHOD(get_IVSize)(short *pVal); 25 | STDMETHOD(get_IV)(VARIANT *pVal); 26 | STDMETHOD(put_IV)(VARIANT Val); 27 | STDMETHOD(GenerateIV)(); 28 | STDMETHOD(get_Padding)(short *pVal); 29 | STDMETHOD(put_Padding)(short Val); 30 | STDMETHOD(Create)(BSTR bstrAlgo = L"DES", short iMode = -1); 31 | STDMETHOD(Encrypt)(VARIANT varInput, VARIANT varOutput, VARIANT* pVal); 32 | STDMETHOD(Decrypt)(VARIANT varInput, VARIANT varOutput, VARIANT* pVal); 33 | 34 | public: 35 | ULONG GetEnum(VARIANT *rgVar, ULONG pos, ULONG count); 36 | 37 | private: 38 | HRESULT do_crypt(VARIANT varInput, VARIANT varOutput, VARIANT* pVal, int enc); 39 | 40 | private: 41 | EVP_CIPHER_CTX m_ctx; 42 | CBAutoPtr m_pKey; 43 | CBAutoPtr m_pIV; 44 | int m_iKeySize; 45 | BOOL m_bPadding; 46 | }; 47 | 48 | -------------------------------------------------------------------------------- /BoxLib/BClassRegistry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BThread.h" 4 | 5 | class CBClassRegistry 6 | { 7 | public: 8 | static HRESULT __stdcall GetLocalClassObject(REFCLSID rclsid, DWORD dwClsContext, LPVOID pvReserved, REFIID riid, LPVOID FAR* ppv); 9 | static HRESULT __stdcall GetClassObject(REFCLSID rclsid, DWORD dwClsContext, LPVOID pvReserved, REFIID riid, LPVOID FAR* ppv); 10 | static HRESULT __stdcall CreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID FAR* ppv); 11 | static HRESULT __stdcall CreateLocalInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID FAR* ppv); 12 | static HRESULT __stdcall CLSIDFromProgID(LPCOLESTR lpszProgID, LPCLSID lpclsid); 13 | static BOOL IsLocalObject(REFCLSID rclsid); 14 | static HRESULT RegSvr32(LPCWSTR pstrName, int nAction); 15 | 16 | static HRESULT RegisterClass(LPCWSTR lpszProgID, REFCLSID rclsid, IClassFactory* pFactory); 17 | static void RemoveAll(); 18 | 19 | private: 20 | static CRBMap > m_mapID2Factory; 21 | static CBCriticalSection m_cs; 22 | }; 23 | 24 | -------------------------------------------------------------------------------- /BoxLib/BCodePage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CBCodePage 4 | { 5 | public: 6 | CBCodePage(UINT uiNowCP = 0); 7 | ~CBCodePage(void); 8 | 9 | public: 10 | static BOOL IsDBCSLeadByte(BYTE TestChar); 11 | static void setCodePage(UINT nCodePage); 12 | static UINT CodePageFromCharSet(LPCSTR strCharSet); 13 | 14 | private: 15 | UINT m_nCodePage; 16 | }; 17 | 18 | -------------------------------------------------------------------------------- /BoxLib/BComm.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BStream.h" 4 | 5 | class __declspec(uuid("94650000-0000-0000-0000-0000436F6D6D")) 6 | CBComm : public CBDispatch 7 | { 8 | DECLARE_CLASS_EX(CBComm, CBStream) 9 | 10 | public: 11 | // IBaseStream 12 | STDMETHOD(Attach)(IUnknown *SrcStream); 13 | STDMETHOD(Open)(long nSize); 14 | 15 | public: 16 | // ICommStream 17 | STDMETHOD(get_BaudRate)(short* pVal); 18 | STDMETHOD(put_BaudRate)(short newVal); 19 | STDMETHOD(get_DataBits)(short* pVal); 20 | STDMETHOD(put_DataBits)(short newVal); 21 | STDMETHOD(get_Handshaking)(short* pVal); 22 | STDMETHOD(put_Handshaking)(short newVal); 23 | STDMETHOD(get_Parity)(short* pVal); 24 | STDMETHOD(put_Parity)(short newVal); 25 | STDMETHOD(get_ReadTimeout)(long *pVal); 26 | STDMETHOD(put_ReadTimeout)(long pVal); 27 | STDMETHOD(get_StopBits)(short* pVal); 28 | STDMETHOD(put_StopBits)(short newVal); 29 | STDMETHOD(get_WriteTimeout)(long *pVal); 30 | STDMETHOD(put_WriteTimeout)(long pVal); 31 | 32 | STDMETHOD(Open)(short lPort, VARIANT varMode = VARIANT_ERROR); 33 | STDMETHOD(Config)(VARIANT varMode = VARIANT_ERROR); 34 | 35 | STDMETHOD(get_ReadBuffer)(long *pVal); 36 | STDMETHOD(put_ReadBuffer)(long pVal); 37 | STDMETHOD(get_WriteBuffer)(long *pVal); 38 | STDMETHOD(put_WriteBuffer)(long pVal); 39 | 40 | STDMETHOD(Purge)(long lFlag); 41 | 42 | protected: 43 | virtual HRESULT InternalRead(void *pv, ULONG cb, ULONG *pcbRead); 44 | virtual HRESULT InternalWrite(const void *pv, ULONG cb, ULONG *pcbWritten); 45 | virtual HRESULT InternalEOS(VARIANT_BOOL *pEOS); 46 | 47 | private: 48 | char m_strName[64]; 49 | DCB m_dcb; 50 | }; 51 | 52 | -------------------------------------------------------------------------------- /BoxLib/BConsole.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "BConsole.h" 3 | 4 | CBConsole::CBConsole(void) 5 | { 6 | m_hInput = ::GetStdHandle(STD_INPUT_HANDLE); 7 | m_hOutput = ::GetStdHandle(STD_OUTPUT_HANDLE); 8 | } 9 | 10 | HRESULT CBConsole::InternalEOS(VARIANT_BOOL *pEOS) 11 | { 12 | return E_NOTIMPL; 13 | } 14 | 15 | HRESULT CBConsole::InternalRead(void *pv, ULONG cb, ULONG *pcbRead) 16 | { 17 | //if (!m_hInput) m_hInput = ::GetStdHandle(STD_INPUT_HANDLE); 18 | if(!::ReadFile(m_hInput, pv, cb, pcbRead, NULL)) 19 | return GetErrorResult(); 20 | 21 | return S_OK; 22 | } 23 | 24 | HRESULT CBConsole::InternalWrite(const void *pv, ULONG cb, ULONG *pcbWritten) 25 | { 26 | //if (!m_hOutput) m_hOutput = ::GetStdHandle(STD_OUTPUT_HANDLE); 27 | if(!::WriteFile(m_hOutput, pv, cb, pcbWritten, NULL)) 28 | return GetErrorResult(); 29 | 30 | return S_OK; 31 | } 32 | 33 | STDMETHODIMP CBConsole::get_Caption(BSTR *pVal) 34 | { 35 | if(IS_NT) 36 | { 37 | CBString strBuffer; 38 | 39 | strBuffer.ReleaseBuffer(::GetConsoleTitleW(strBuffer.GetBuffer(1024), 1024)); 40 | *pVal = strBuffer.AllocSysString(); 41 | }else 42 | { 43 | CBStringA strBuffer; 44 | 45 | strBuffer.ReleaseBuffer(::GetConsoleTitle(strBuffer.GetBuffer(1024), 1024)); 46 | *pVal = strBuffer.AllocSysString(); 47 | } 48 | 49 | return S_OK; 50 | } 51 | 52 | STDMETHODIMP CBConsole::put_Caption(BSTR pVal) 53 | { 54 | if(IS_NT) 55 | ::SetConsoleTitleW(pVal); 56 | else 57 | ::SetConsoleTitleA(CBStringA(pVal)); 58 | 59 | return S_OK; 60 | } 61 | 62 | -------------------------------------------------------------------------------- /BoxLib/BConsole.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "bstream.h" 3 | 4 | class __declspec(uuid("94650000-0000-0000-0043-6F6E736F6C65")) 5 | CBConsole : public CBDispatch 6 | { 7 | DECLARE_CLASS_EX(CBConsole, CBStream) 8 | 9 | public: 10 | CBConsole(void); 11 | 12 | protected: 13 | virtual HRESULT InternalRead(void *pv, ULONG cb, ULONG *pcbRead); 14 | virtual HRESULT InternalWrite(const void *pv, ULONG cb, ULONG *pcbWritten); 15 | virtual HRESULT InternalEOS(VARIANT_BOOL *pEOS); 16 | 17 | public: 18 | // IBaseStream 19 | STDMETHOD(Write)(VARIANT varBuffer){return E_NOTIMPL;} 20 | 21 | public: 22 | // IConsole 23 | STDMETHOD(get_Caption)(BSTR *pVal); 24 | STDMETHOD(put_Caption)(BSTR pVal); 25 | 26 | private: 27 | HANDLE m_hInput, m_hOutput; 28 | }; 29 | -------------------------------------------------------------------------------- /BoxLib/BDatabase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BThread.h" 4 | 5 | class __declspec(uuid("94650000-0000-0000-4461-746162617365")) 6 | CBDatabase : public CBDispatch 7 | { 8 | DECLARE_CLASS(CBDatabase) 9 | 10 | public: 11 | CBDatabase(void); 12 | ~CBDatabase(void); 13 | 14 | public: 15 | // IDatabase 16 | STDMETHOD(Open)(BSTR Path, short Sync = 2); 17 | STDMETHOD(Close)(void); 18 | STDMETHOD(Execute)(BSTR strCommand, long start, long len, IRecordset **ppRS); 19 | STDMETHOD(GetTable)(BSTR strTable, IRecordset **ppRS); 20 | STDMETHOD(BeginTrans)(void); 21 | STDMETHOD(CommitTrans)(void); 22 | STDMETHOD(RollbackTrans)(void); 23 | STDMETHOD(Shrink)(void); 24 | STDMETHOD(get_CommandTimeout)(short *pVal); 25 | STDMETHOD(put_CommandTimeout)(short pVal); 26 | STDMETHOD(get_Synchronous)(short *pVal); 27 | STDMETHOD(put_Synchronous)(short pVal); 28 | STDMETHOD(get_TotalReadTimes)(long *pVal); 29 | STDMETHOD(get_TotalReadBytes)(double *pVal); 30 | STDMETHOD(get_TotalWriteTimes)(long *pVal); 31 | STDMETHOD(get_TotalWriteBytes)(double *pVal); 32 | STDMETHOD(get_TotalExecTime)(double *pVal); 33 | 34 | public: 35 | HRESULT Execute(LPCSTR strCommand, long start = 0, long len = -1, IRecordset **ppRS = NULL); 36 | 37 | private: 38 | CBCriticalSection m_cs; 39 | void* m_pDB; 40 | short m_nCmdTimeout; 41 | __int64 m_nStart; 42 | 43 | void Enter(); 44 | void Leave(); 45 | 46 | public: 47 | long m_nTotalReadTimes; 48 | double m_nTotalReadBytes; 49 | long m_nTotalWriteTimes; 50 | double m_nTotalWriteBytes; 51 | __int64 m_nTotalExecTime; 52 | }; 53 | 54 | extern VARIANT s_varNULL; 55 | 56 | -------------------------------------------------------------------------------- /BoxLib/BDate.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "BDate.h" 3 | 4 | static CBComPtr s_pNow; 5 | static CBComPtr s_pNowFast; 6 | static HANDLE s_hThread; 7 | static BOOL s_bExit; 8 | static SYSTEMTIME s_st; 9 | 10 | static DWORD WINAPI timeProc(void *p) 11 | { 12 | SYSTEMTIME st; 13 | 14 | while(s_bExit) 15 | { 16 | ::Sleep(1); 17 | 18 | GetSystemTime(&st); 19 | CBComPtr pNow; 20 | 21 | pNow.CreateInstance(); 22 | pNow->m_date = st; 23 | s_pNowFast = pNow; 24 | 25 | st.wMilliseconds = 0; 26 | 27 | if(st.wSecond != s_st.wSecond) 28 | { 29 | s_st = st; 30 | pNow.CreateInstance(); 31 | pNow->m_date = st; 32 | pNow->m_strGMT = pNow->m_date; 33 | s_pNow = pNow; 34 | } 35 | } 36 | 37 | return 0; 38 | } 39 | 40 | void CBDateEx::Startup() 41 | { 42 | if(!s_hThread) 43 | { 44 | DWORD dwTheradId; 45 | 46 | GetSystemTime(&s_st); 47 | 48 | s_pNowFast.CreateInstance(); 49 | s_pNowFast->m_date = s_st; 50 | 51 | s_st.wMilliseconds = 0; 52 | s_pNow.CreateInstance(); 53 | s_pNow->m_date = s_st; 54 | s_pNow->m_strGMT = s_pNow->m_date; 55 | 56 | s_hThread = ::CreateThread(NULL, 0, timeProc, 0, 0, &dwTheradId); 57 | } 58 | } 59 | 60 | void CBDateEx::Cleanup() 61 | { 62 | if(s_hThread) 63 | { 64 | s_bExit = TRUE; 65 | ::WaitForSingleObject(s_hThread, INFINITE); 66 | ::CloseHandle(s_hThread); 67 | s_hThread = NULL; 68 | s_pNow.Release(); 69 | } 70 | } 71 | 72 | void CBDateEx::GetDate(CBDateEx** pDate) 73 | { 74 | *(CBComPtr*)pDate = s_pNow; 75 | } 76 | 77 | void CBDateEx::GetFastDate(CBDateEx** pDate) 78 | { 79 | *(CBComPtr*)pDate = s_pNowFast; 80 | } 81 | 82 | -------------------------------------------------------------------------------- /BoxLib/BDirectory.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "BDirectory.h" 3 | 4 | HRESULT CBDirectory::getItem(BSTR strPath, CRBMap::CPair** ppPair, BOOL bAutoCreate) 5 | { 6 | return S_OK; 7 | } 8 | 9 | STDMETHODIMP CBDirectory::get_AutoCreateDirectory(VARIANT_BOOL *pbACD) 10 | { 11 | m_cs.Enter(); 12 | *pbACD = m_bAutoCreateDirectory ? VARIANT_TRUE : VARIANT_FALSE; 13 | m_cs.Leave(); 14 | 15 | return S_OK; 16 | } 17 | 18 | STDMETHODIMP CBDirectory::put_AutoCreateDirectory(VARIANT_BOOL bACD) 19 | { 20 | m_cs.Enter(); 21 | m_bAutoCreateDirectory = (bACD == VARIANT_TRUE); 22 | m_cs.Leave(); 23 | 24 | return S_OK; 25 | } 26 | 27 | STDMETHODIMP CBDirectory::CreateDirectory(BSTR strPath) 28 | { 29 | return E_NOTIMPL; 30 | } 31 | 32 | STDMETHODIMP CBDirectory::CopyTo(BSTR strFrom, BSTR strTo) 33 | { 34 | return E_NOTIMPL; 35 | } 36 | 37 | STDMETHODIMP CBDirectory::MoveTo(BSTR strFrom, BSTR strTo) 38 | { 39 | return E_NOTIMPL; 40 | } 41 | 42 | STDMETHODIMP CBDirectory::Link(BSTR strFrom, BSTR strTo) 43 | { 44 | return E_NOTIMPL; 45 | } 46 | 47 | 48 | -------------------------------------------------------------------------------- /BoxLib/BDirectory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BDictionary.h" 4 | 5 | class CBPath 6 | { 7 | public: 8 | CBPath(void) 9 | { 10 | m_strPath = new WCHAR[MAX_PATH]; 11 | m_strPath[0] = 0; 12 | } 13 | 14 | ~CBPath(void) 15 | { 16 | delete m_strPath; 17 | } 18 | 19 | void Combine(LPCWSTR pstrBasePath, LPCWSTR pstrFile = NULL) 20 | { 21 | int nCount = 0; 22 | 23 | while(pstrBasePath != NULL || pstrFile != NULL) 24 | { 25 | if(pstrBasePath == NULL) 26 | { 27 | pstrBasePath = pstrFile; 28 | pstrFile = NULL; 29 | } 30 | 31 | while(*pstrBasePath && nCount < MAX_PATH - 1) 32 | { 33 | while(*pstrBasePath && 34 | (*pstrBasePath == _T('\\') || *pstrBasePath == _T('/') || 35 | (*pstrBasePath == _T('.') && (pstrBasePath[1] == _T('\\') || pstrBasePath[1] == _T('/'))))) 36 | pstrBasePath ++; 37 | 38 | if(*pstrBasePath == _T('.') && pstrBasePath[1] == _T('.') && 39 | (pstrBasePath[2] == _T('\\') || pstrBasePath[2] == _T('/'))) 40 | { 41 | while(nCount > 0 && m_strPath[nCount - 1] != _T('\\')) 42 | nCount --; 43 | pstrBasePath += 3; 44 | if(nCount > 0) 45 | nCount --; 46 | continue; 47 | } 48 | 49 | if(*pstrBasePath) 50 | { 51 | m_strPath[nCount ++] = _T('\\'); 52 | while(nCount < MAX_PATH - 1 && *pstrBasePath && 53 | *pstrBasePath != _T('\\') && *pstrBasePath != _T('/')) 54 | m_strPath[nCount ++] = *pstrBasePath ++; 55 | }else if(pstrFile == NULL) 56 | m_strPath[nCount ++] = _T('\\'); 57 | } 58 | 59 | pstrBasePath = pstrFile; 60 | pstrFile = NULL; 61 | } 62 | 63 | m_strPath[nCount] = 0; 64 | } 65 | 66 | LPWSTR m_strPath; 67 | }; 68 | 69 | class __declspec(uuid("94650000-0000-0044-6972-6563746F7279")) 70 | CBDirectory : public CBDispatchEx 71 | { 72 | DECLARE_CLASS_EX(CBDirectory, CBDictionary) 73 | 74 | public: 75 | // IVariantDirectory 76 | STDMETHOD(get_AutoCreateDirectory)(VARIANT_BOOL *pbACD); 77 | STDMETHOD(put_AutoCreateDirectory)(VARIANT_BOOL bACD); 78 | 79 | STDMETHOD(CreateDirectory)(BSTR strPath); 80 | STDMETHOD(CopyTo)(BSTR strFrom, BSTR strTo); 81 | STDMETHOD(MoveTo)(BSTR strFrom, BSTR strTo); 82 | STDMETHOD(Link)(BSTR strFrom, BSTR strTo); 83 | 84 | private: 85 | HRESULT getItem(BSTR strPath, CRBMap::CPair** ppPair, BOOL bAutoCreate); 86 | BOOL m_bAutoCreateDirectory; 87 | }; 88 | 89 | -------------------------------------------------------------------------------- /BoxLib/BECC.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class __declspec(uuid("94650000-0000-0000-0000-000000454343")) 4 | CBECC : public CBDispatch 5 | { 6 | DECLARE_CLASS(CBECC) 7 | APARTMENT_MODE 8 | 9 | public: 10 | CBECC(void) : m_pECC(NULL), m_nPadding(1) 11 | {} 12 | 13 | ~CBECC(void) 14 | { 15 | free(); 16 | } 17 | 18 | public: 19 | STDMETHOD(get_IsPrivateKey)(VARIANT_BOOL *pVal); 20 | STDMETHOD(get_Key)(VARIANT *pVal); 21 | STDMETHOD(get_KeySize)(short *pVal); 22 | STDMETHOD(get_Parameter)(VARIANT *pVal); 23 | STDMETHOD(put_Parameter)(VARIANT newVal); 24 | STDMETHOD(get_PrivateKey)(VARIANT *pVal); 25 | STDMETHOD(put_PrivateKey)(VARIANT newVal); 26 | STDMETHOD(get_PublicKey)(VARIANT *pVal); 27 | STDMETHOD(put_PublicKey)(VARIANT newVal); 28 | STDMETHOD(Decrypt)(VARIANT varData, VARIANT *pVal); 29 | STDMETHOD(Encrypt)(VARIANT varData, VARIANT *pVal); 30 | STDMETHOD(GenerateKey)(VARIANT varSize = VARIANT_ERROR); 31 | 32 | STDMETHOD(get_DSASize)(short *pVal); 33 | STDMETHOD(DSASign)(VARIANT varData, VARIANT *pVal); 34 | STDMETHOD(DSAVerify)(VARIANT varData, VARIANT varSig, VARIANT_BOOL *retVal); 35 | 36 | private: 37 | void *m_pECC; 38 | short m_nPadding; 39 | 40 | void free(void); 41 | }; 42 | -------------------------------------------------------------------------------- /BoxLib/BEncoding.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CBEncoding : public CBDispatch 4 | { 5 | public: 6 | STDMETHOD(Base32Decode)(BSTR base32String, VARIANT *retVal); 7 | STDMETHOD(Base32Encode)(VARIANT varData, short nLineBreak, BSTR *retVal); 8 | 9 | STDMETHOD(Base64Decode)(BSTR base64String, VARIANT *retVal); 10 | STDMETHOD(Base64Encode)(VARIANT varData, short nLineBreak, BSTR *retVal); 11 | 12 | STDMETHOD(BinToStr)(VARIANT varData, long nCodePage, BSTR *retVal); 13 | STDMETHOD(StrToBin)(BSTR strData, long nCodePage, VARIANT *retVal); 14 | 15 | STDMETHOD(CsvDecode)(BSTR bstrText, VARIANT* retVal); 16 | STDMETHOD(CsvEncode)(VARIANT varArray, BSTR* retVal); 17 | 18 | STDMETHOD(HexDecode)(BSTR HexString, VARIANT *retVal); 19 | STDMETHOD(HexEncode)(VARIANT varData, short nLineBreak, BSTR *retVal); 20 | 21 | STDMETHOD(HtmlEncode)(BSTR TextString, BSTR *retVal); 22 | STDMETHOD(HtmlFormat)(BSTR TextString, BSTR* retVal); 23 | 24 | STDMETHOD(JSEncode)(BSTR TextString, BSTR *retVal); 25 | 26 | STDMETHOD(SQLEncode)(VARIANT varValue, BSTR *retVal); 27 | 28 | STDMETHOD(UrlDecode)(BSTR urlString, BSTR *retVal); 29 | STDMETHOD(UrlEncode)(BSTR urlString, BSTR *retVal); 30 | 31 | STDMETHOD(xmlEncode)(BSTR TextString, BSTR *retVal); 32 | 33 | static CBString UrlDecode(LPCSTR urlString, UINT len); 34 | static CBString UrlDecode(CBStringA str) 35 | { 36 | return UrlDecode(str, str.GetLength()); 37 | } 38 | 39 | static CBStringA UrlEncode(LPCSTR urlString, UINT len, BOOL bEncodeDBMS = FALSE); 40 | static CBStringA UrlEncode(CBStringA str, BOOL bEncodeDBMS = FALSE) 41 | { 42 | return UrlEncode(str, str.GetLength(), bEncodeDBMS); 43 | } 44 | 45 | STDMETHOD(Deflate)(VARIANT varData, VARIANT* retVal); 46 | STDMETHOD(Inflate)(VARIANT varData, VARIANT* retVal); 47 | 48 | static HRESULT FormatMessage(LPCWSTR strFmtString, UINT len, BSTR bstr1, BSTR bstr2, BSTR bstr3, BSTR bstr4, BSTR bstr5, BSTR bstr6, BSTR bstr7, BSTR bstr8, BSTR *bstrMessage); 49 | STDMETHOD(FormatMessage)(BSTR bstrFmtString, BSTR bstr1, BSTR bstr2, BSTR bstr3, BSTR bstr4, BSTR bstr5, BSTR bstr6, BSTR bstr7, BSTR bstr8, BSTR *bstrMessage); 50 | }; 51 | 52 | -------------------------------------------------------------------------------- /BoxLib/BErrorTrace.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "BErrorTrace.h" 3 | 4 | CBErrorTrace::CBErrorTrace(void) 5 | { 6 | m_pStream.CreateInstance(); 7 | m_date.GetTime(); 8 | } 9 | 10 | CBErrorTrace::~CBErrorTrace(void) 11 | { 12 | } 13 | 14 | STDMETHODIMP CBErrorTrace::get_Name(BSTR *pVal) 15 | { 16 | *pVal = m_strName.AllocSysString(); 17 | return S_OK; 18 | } 19 | 20 | STDMETHODIMP CBErrorTrace::get_StartTime(DATE *pVal) 21 | { 22 | *pVal = m_date; 23 | return S_OK; 24 | } 25 | 26 | void CBErrorTrace::Write(const void* pData, int size) 27 | { 28 | CBString strDate; 29 | SYSTEMTIME st; 30 | 31 | GetSystemTime(&st); 32 | 33 | strDate.Format(L"[%02d-%02d %02d:%02d:%02d]", st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); 34 | 35 | m_cs.Enter(); 36 | m_pStream->Write((LPCWSTR)strDate, strDate.GetLength() * 2); 37 | m_pStream->Write(pData, size); 38 | m_pStream->Write(L"\r\n", 4); 39 | m_cs.Leave(); 40 | } 41 | 42 | STDMETHODIMP CBErrorTrace::Write(BSTR strText) 43 | { 44 | Write(strText, ::SysStringByteLen(strText)); 45 | return S_OK; 46 | } 47 | 48 | STDMETHODIMP CBErrorTrace::ReadAll(BSTR *pVal) 49 | { 50 | ULONG l; 51 | 52 | m_cs.Enter(); 53 | 54 | *pVal = ::SysAllocStringByteLen(NULL, l = (ULONG)m_pStream->GetLength()); 55 | 56 | m_pStream->SeekToBegin(); 57 | m_pStream->Read(*pVal, l); 58 | 59 | m_cs.Leave(); 60 | 61 | return S_OK; 62 | } 63 | 64 | STDMETHODIMP CBErrorTrace::Clear(void) 65 | { 66 | m_cs.Enter(); 67 | m_pStream.CreateInstance(); 68 | Write(L"The log was cleared.", 40); 69 | m_cs.Leave(); 70 | 71 | return S_OK; 72 | } 73 | -------------------------------------------------------------------------------- /BoxLib/BErrorTrace.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BMStream.h" 4 | #include "BDate.h" 5 | 6 | class __declspec(uuid("94650000-0000-4572-726F-725472616365")) 7 | CBErrorTrace : public CBDispatch 8 | { 9 | public: 10 | CBErrorTrace(void); 11 | ~CBErrorTrace(void); 12 | 13 | public: 14 | STDMETHOD(get_Name)(BSTR *pVal); 15 | STDMETHOD(get_StartTime)(DATE *pVal); 16 | STDMETHOD(Write)(BSTR strText); 17 | STDMETHOD(ReadAll)(BSTR *pVal); 18 | STDMETHOD(Clear)(void); 19 | 20 | void Write(const void* pData, int size); 21 | void SetName(CBString strName) 22 | { 23 | m_strName = strName; 24 | } 25 | 26 | private: 27 | CBCriticalSection m_cs; 28 | CBString m_strName; 29 | CBComPtr m_pStream; 30 | CBDate m_date; 31 | int m_count; 32 | }; 33 | 34 | -------------------------------------------------------------------------------- /BoxLib/BFile.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BStream.h" 4 | 5 | class __declspec(uuid("94650000-0000-0000-0000-000046696C65")) 6 | CBFile : public CBDispatch 7 | { 8 | DECLARE_CLASS_EX(CBFile, CBStream) 9 | 10 | public: 11 | enum OpenFlags 12 | { 13 | modeRead = (int) 0x00001, 14 | modeWrite = (int) 0x00002, 15 | modeReadWrite = (int) 0x00003, 16 | modeAppend = (int) 0x00008, 17 | modeCreate = (int) 0x00010, 18 | 19 | shareRead = (int) 0x00001, 20 | shareWrite = (int) 0x00002, 21 | shareReadWrite = (int) 0x00003, 22 | shareDelete = (int) 0x00004, 23 | shareAll = (int) 0x00007 24 | }; 25 | 26 | public: 27 | // IBaseStream 28 | STDMETHOD(Attach)(IUnknown *SrcStream); 29 | 30 | public: 31 | // IFileStream 32 | 33 | STDMETHOD(Create)(BSTR bstrName, VARIANT_BOOL bOverwrite = -1); 34 | STDMETHOD(Open)(BSTR bstrName, short nMode = modeRead, short nShare = shareReadWrite); 35 | }; 36 | 37 | -------------------------------------------------------------------------------- /BoxLib/BFolderDictionary.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "BFolderDictionary.h" 3 | 4 | STDMETHODIMP CBFolderDictionary::get_Item(VARIANT VarKey, VARIANT *pVariantReturn) 5 | { 6 | HRESULT hr; 7 | 8 | m_cs.Enter(); 9 | hr = m_dict.get_Item(VarKey, pVariantReturn); 10 | m_cs.Leave(); 11 | 12 | return hr; 13 | } 14 | 15 | STDMETHODIMP CBFolderDictionary::get__NewEnum(IUnknown **ppEnumReturn) 16 | { 17 | HRESULT hr; 18 | 19 | m_cs.Enter(); 20 | hr = getNewEnum(this, ppEnumReturn); 21 | m_cs.Leave(); 22 | 23 | return hr; 24 | } 25 | 26 | STDMETHODIMP CBFolderDictionary::get_Count(long *cStrRet) 27 | { 28 | m_cs.Enter(); 29 | *cStrRet = (long)m_dict.GetCount(); 30 | m_cs.Leave(); 31 | 32 | return S_OK; 33 | } 34 | 35 | STDMETHODIMP CBFolderDictionary::get_Key(VARIANT VarKey, VARIANT *pvar) 36 | { 37 | HRESULT hr; 38 | 39 | m_cs.Enter(); 40 | hr = m_dict.get_Key(VarKey, pvar); 41 | m_cs.Leave(); 42 | 43 | return hr; 44 | } 45 | 46 | STDMETHODIMP CBFolderDictionary::Exists(VARIANT VarKey, VARIANT_BOOL *pExists) 47 | { 48 | HRESULT hr; 49 | 50 | m_cs.Enter(); 51 | hr = m_dict.Exists(VarKey, pExists); 52 | m_cs.Leave(); 53 | 54 | return hr; 55 | } 56 | 57 | STDMETHODIMP CBFolderDictionary::get_Items(VARIANT *pItemsArray) 58 | { 59 | HRESULT hr; 60 | 61 | m_cs.Enter(); 62 | hr = m_dict.get_Items(pItemsArray); 63 | m_cs.Leave(); 64 | 65 | return hr; 66 | } 67 | 68 | STDMETHODIMP CBFolderDictionary::get_Keys(VARIANT *pKeysArray) 69 | { 70 | HRESULT hr; 71 | 72 | m_cs.Enter(); 73 | hr = m_dict.get_Keys(pKeysArray); 74 | m_cs.Leave(); 75 | 76 | return hr; 77 | } 78 | 79 | -------------------------------------------------------------------------------- /BoxLib/BFolderDictionary.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BCollection.h" 4 | 5 | class __declspec(uuid("94650000-6572-4469-6374-696F6E617279")) 6 | CBFolderDictionary : public CBDispatch 7 | { 8 | DECLARE_CLASS(CBFolderDictionary) 9 | 10 | public: 11 | // IRequestDictionary 12 | STDMETHOD(get_Item)(VARIANT VarKey, VARIANT *pVariantReturn); 13 | STDMETHOD(get__NewEnum)(IUnknown **ppEnumReturn); 14 | STDMETHOD(get_Count)(long *cStrRet); 15 | STDMETHOD(get_Key)(VARIANT VarKey, VARIANT *pvar); 16 | 17 | STDMETHOD(Exists)(VARIANT VarKey, VARIANT_BOOL *pExists); 18 | 19 | STDMETHOD(get_Items)(VARIANT *pItemsArray); 20 | STDMETHOD(get_Keys)(VARIANT *pKeysArray); 21 | 22 | public: 23 | ULONG GetEnum(VARIANT *rgVar, ULONG pos, ULONG count) 24 | { 25 | return m_dict.GetEnum(rgVar, pos, count); 26 | } 27 | 28 | template 29 | void AddValue(CBString strKey, const TYPE& value) 30 | { 31 | *(CComVariant*)&m_dict[strKey] = value; 32 | } 33 | 34 | private: 35 | CBDict m_dict; 36 | CBCriticalSection m_cs; 37 | }; 38 | 39 | -------------------------------------------------------------------------------- /BoxLib/BGDI.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "BGDI.h" 3 | 4 | -------------------------------------------------------------------------------- /BoxLib/BHash.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BVarType.h" 4 | #include "BCollection.h" 5 | 6 | class __declspec(uuid("94650000-0000-0000-0000-000048617368")) 7 | CBHash : public CBDispatch 8 | { 9 | DECLARE_CLASS(CBHash) 10 | APARTMENT_MODE 11 | 12 | public: 13 | CBHash(void) : m_iAlgo(-1) 14 | {} 15 | 16 | public: 17 | // IHash 18 | STDMETHOD(get__NewEnum)(IUnknown** ppEnumReturn); 19 | STDMETHOD(get_Name)(BSTR *pVal); 20 | STDMETHOD(get_HashSize)(short *pVal); 21 | STDMETHOD(Create)(BSTR bstrAlgo = L"MD5", VARIANT varKey = VARIANT_ERROR); 22 | STDMETHOD(Update)(VARIANT varData); 23 | STDMETHOD(Final)(VARIANT varData, VARIANT *retVal); 24 | 25 | public: 26 | ULONG GetEnum(VARIANT *rgVar, ULONG pos, ULONG count); 27 | 28 | private: 29 | BYTE m_ctx[256]; 30 | int m_iAlgo; 31 | CBVarPtr m_varKey; 32 | }; 33 | 34 | -------------------------------------------------------------------------------- /BoxLib/BHook.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CBHook 4 | { 5 | public: 6 | PROC m_pfnOrig; 7 | PROC m_pfnNew; 8 | CBHook * m_pNext; 9 | 10 | void Init(); 11 | 12 | public: 13 | static void DoHook(BOOL bHook = TRUE); 14 | template CBHook(F pfnOrig, F pfnNew) : 15 | m_pfnOrig((PROC)pfnOrig), m_pfnNew((PROC)pfnNew) 16 | { Init();} 17 | 18 | template CBHook(LPCSTR strModule, LPCSTR strFunction, F pfnNew, F* ppfnOrig = NULL) : 19 | m_pfnOrig(NULL), m_pfnNew((PROC)pfnNew) 20 | { 21 | HMODULE h; 22 | 23 | h = GetModuleHandleA(strModule); 24 | 25 | if(!h) 26 | h = LoadLibraryA(strModule); 27 | 28 | if(h != NULL) 29 | { 30 | m_pfnOrig = GetProcAddress(h, strFunction); 31 | if(ppfnOrig)*(PROC*)ppfnOrig = m_pfnOrig; 32 | } 33 | 34 | Init(); 35 | } 36 | }; 37 | 38 | HMODULE WINAPI NewLoadLibraryA(PCSTR); 39 | FARPROC WINAPI NewGetProcAddress(HMODULE hModule, LPCSTR lpProcName); 40 | -------------------------------------------------------------------------------- /BoxLib/BIdentity.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include ".\bidentity.h" 3 | 4 | STDMETHODIMP CBIdentity::get_Item(BSTR strKey, LONG nCount, VARIANT *pvar) 5 | { 6 | VARIANT *pvarFind; 7 | 8 | if(nCount < 0)nCount = 1; 9 | 10 | CBLock l(&m_cs); 11 | 12 | if(m_dict.Lookup(strKey, &pvarFind) == S_OK) 13 | { 14 | *pvar = *pvarFind; 15 | 16 | switch (pvarFind->vt) 17 | { 18 | case VT_UI1: 19 | case VT_I1: 20 | pvarFind->cVal += (BYTE)nCount; 21 | break; 22 | case VT_I2: 23 | case VT_UI2: 24 | case VT_BOOL: 25 | pvarFind->iVal += (WORD)nCount; 26 | break; 27 | case VT_I4: 28 | case VT_UI4: 29 | case VT_INT: 30 | case VT_UINT: 31 | case VT_ERROR: 32 | pvarFind->lVal += nCount; 33 | break; 34 | case VT_I8: 35 | case VT_UI8: 36 | pvarFind->llVal += nCount; 37 | break; 38 | case VT_R4: 39 | pvarFind->fltVal += nCount; 40 | break; 41 | case VT_R8: 42 | case VT_CY: 43 | case VT_DATE: 44 | pvarFind->dblVal += nCount; 45 | break; 46 | } 47 | } 48 | 49 | return S_OK; 50 | } 51 | 52 | STDMETHODIMP CBIdentity::get__NewEnum(IUnknown **ppEnumReturn) 53 | { 54 | return getNewEnum(this, ppEnumReturn); 55 | } 56 | 57 | STDMETHODIMP CBIdentity::get_Items(VARIANT *pItemsArray) 58 | { 59 | CBLock l(&m_cs); 60 | 61 | return m_dict.get_Items(pItemsArray); 62 | } 63 | 64 | STDMETHODIMP CBIdentity::get_Keys(VARIANT *pKeysArray) 65 | { 66 | CBLock l(&m_cs); 67 | 68 | return m_dict.get_Keys(pKeysArray); 69 | } 70 | 71 | STDMETHODIMP CBIdentity::Add(BSTR strKey, VARIANT var) 72 | { 73 | if(!CBVariant::GetSize(var.vt)) 74 | return DISP_E_TYPEMISMATCH; 75 | 76 | VARIANT* pvar; 77 | 78 | CBLock l(&m_cs); 79 | 80 | if(m_dict.Lookup(strKey, &pvar, TRUE) == S_OK) 81 | return 0x800A01C9; 82 | 83 | *pvar = var; 84 | 85 | return S_OK; 86 | } 87 | 88 | STDMETHODIMP CBIdentity::Exists(BSTR strKey, VARIANT_BOOL *pExists) 89 | { 90 | CBLock l(&m_cs); 91 | 92 | return m_dict.Exists(strKey, pExists); 93 | } 94 | 95 | STDMETHODIMP CBIdentity::GenGUIDString(BSTR* retVal) 96 | { 97 | GUID id; 98 | LPOLESTR ppsz = NULL; 99 | HRESULT hr; 100 | 101 | hr = CoCreateGuid(&id); 102 | if(FAILED(hr))return hr; 103 | 104 | hr = ::StringFromCLSID(id, &ppsz); 105 | if(FAILED(hr))return hr; 106 | 107 | *retVal = ::SysAllocString(ppsz); 108 | 109 | CoTaskMemFree(ppsz); 110 | 111 | return S_OK; 112 | } 113 | 114 | -------------------------------------------------------------------------------- /BoxLib/BIdentity.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BCollection.h" 4 | 5 | class __declspec(uuid("94650000-0000-0000-4964-656E74697479")) 6 | CBIdentity : public CBDispatch 7 | { 8 | DECLARE_CLASS(CBIdentity) 9 | 10 | public: 11 | // IIdentity 12 | STDMETHOD(get_Item)(BSTR strKey, LONG nCount, VARIANT *pvar); 13 | STDMETHOD(get__NewEnum)(IUnknown **ppEnumReturn); 14 | STDMETHOD(get_Items)(VARIANT *pItemsArray); 15 | STDMETHOD(get_Keys)(VARIANT *pKeysArray); 16 | STDMETHOD(Add)(BSTR strKey, VARIANT var); 17 | STDMETHOD(Exists)(BSTR strKey, VARIANT_BOOL *pExists); 18 | STDMETHOD(GenGUIDString)(BSTR* retVal); 19 | 20 | public: 21 | ULONG GetEnum(VARIANT *rgVar, ULONG pos, ULONG count) 22 | { 23 | CBLock l(&m_cs); 24 | return m_dict.GetEnum(rgVar, pos, count); 25 | } 26 | 27 | private: 28 | CBDict m_dict; 29 | CBCriticalSection m_cs; 30 | }; 31 | 32 | -------------------------------------------------------------------------------- /BoxLib/BInterlock.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | 3 | __declspec(naked) ULONG __stdcall InterlockedAddRef(long* pdwRef) 4 | { 5 | _asm 6 | { 7 | mov ecx, [esp+4] 8 | mov eax, 1 9 | lock xadd [ecx],eax 10 | cmp eax, 0 11 | jz InternalAddRefRet 12 | inc eax 13 | ret 4 14 | InternalAddRefRet: 15 | mov [ecx], eax 16 | ret 4 17 | } 18 | } 19 | 20 | __declspec(naked) ULONG __stdcall InterlockedRelease(long* pdwRef) 21 | { 22 | _asm 23 | { 24 | mov ecx, [esp+4] 25 | mov eax,0FFFFFFFFh 26 | lock xadd [ecx],eax 27 | dec eax 28 | ret 4 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /BoxLib/BList.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "BList.h" 3 | #include "BVarType.h" 4 | 5 | CBList::~CBList(void) 6 | { 7 | RemoveAll(); 8 | } 9 | 10 | STDMETHODIMP CBList::get_Default(VARIANT *pVariantReturn) 11 | { 12 | return DISP_E_PARAMNOTOPTIONAL; 13 | } 14 | 15 | STDMETHODIMP CBList::get_Item(VARIANT i, VARIANT *pVariantReturn) 16 | { 17 | if(i.vt == VT_ERROR) 18 | return get_Default(pVariantReturn); 19 | 20 | long n = varGetNumber(i); 21 | 22 | if(n >=0 && n < (int)m_arrayVariant.GetCount()) 23 | VariantCopy(pVariantReturn, &m_arrayVariant[n]); 24 | else return DISP_E_BADINDEX; 25 | 26 | return S_OK; 27 | } 28 | 29 | STDMETHODIMP CBList::get_Count(long *cStrRet) 30 | { 31 | *cStrRet = (long)m_arrayVariant.GetCount(); 32 | 33 | return S_OK; 34 | } 35 | 36 | STDMETHODIMP CBList::get_Items(VARIANT *pItemsArray) 37 | { 38 | CComSafeArray bstrArray; 39 | VARIANT* pVar; 40 | HRESULT hr; 41 | 42 | hr = bstrArray.Create((ULONG)m_arrayVariant.GetCount()); 43 | if(FAILED(hr)) 44 | return hr; 45 | 46 | pVar = (VARIANT*)bstrArray.m_psa->pvData; 47 | 48 | for(int i = 0; i < (int)m_arrayVariant.GetCount(); i ++) 49 | { 50 | hr = VariantCopy(&pVar[i], &m_arrayVariant[i]); 51 | if(FAILED(hr)) 52 | { 53 | bstrArray.Destroy(); 54 | return hr; 55 | } 56 | } 57 | 58 | pItemsArray->vt = VT_ARRAY | VT_VARIANT; 59 | pItemsArray->parray = bstrArray.Detach(); 60 | 61 | return S_OK; 62 | } 63 | 64 | STDMETHODIMP CBList::get__NewEnum(IUnknown **ppEnumReturn) 65 | { 66 | return getNewEnum(this, ppEnumReturn); 67 | } 68 | 69 | static int staticCompare(VARIANT* pvar1, VARIANT* pvar2) 70 | { 71 | CBString str1, str2; 72 | 73 | varGetString(pvar1, str1); 74 | varGetString(pvar2, str2); 75 | 76 | return str1.CompareNoCase(str2); 77 | } 78 | 79 | void CBList::Sort(void) 80 | { 81 | qsort(m_arrayVariant.GetData(), m_arrayVariant.GetCount(), sizeof(VARIANT), 82 | (int (__cdecl *)(const void *,const void *))staticCompare); 83 | } 84 | 85 | -------------------------------------------------------------------------------- /BoxLib/BList.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BCollection.h" 4 | 5 | class __declspec(uuid("94650000-0056-6172-6961-6E744C697374")) 6 | CBList : public CBDispatch 7 | { 8 | DECLARE_CLASS(CBList) 9 | 10 | public: 11 | ~CBList(void); 12 | 13 | public: 14 | STDMETHOD(get_Item)(VARIANT i, VARIANT *pVariantReturn); 15 | STDMETHOD(get_Count)(long *cStrRet); 16 | STDMETHOD(get__NewEnum)(IUnknown **ppEnumReturn); 17 | STDMETHOD(get_Items)(VARIANT *pItemsArray); 18 | 19 | STDMETHOD(get_Default)(VARIANT *pVariantReturn); 20 | 21 | template 22 | void AddValue(const TYPE& value) 23 | { 24 | VARIANT var = {VT_EMPTY}; 25 | 26 | *(CComVariant*)&var = value; 27 | m_arrayVariant.Add(var); 28 | } 29 | 30 | HRESULT get_Item(int i, VARIANT *pVariantReturn) 31 | { 32 | if(i >=0 && i < (int)m_arrayVariant.GetCount()) 33 | VariantCopy(pVariantReturn, &m_arrayVariant[i]); 34 | else return DISP_E_BADINDEX; 35 | 36 | return S_OK; 37 | } 38 | 39 | void RemoveAll() 40 | { 41 | for(int i = 0; i < (int)m_arrayVariant.GetCount(); i ++) 42 | VariantClear(&m_arrayVariant[i]); 43 | 44 | m_arrayVariant.RemoveAll(); 45 | } 46 | 47 | void Remove(UINT i) 48 | { 49 | if(i < (int)m_arrayVariant.GetCount()) 50 | { 51 | VariantClear(&m_arrayVariant[i]); 52 | m_arrayVariant.RemoveAt(i); 53 | } 54 | } 55 | 56 | UINT GetCount(void) 57 | { 58 | return m_arrayVariant.GetCount(); 59 | } 60 | 61 | CBString GetString(UINT i) 62 | { 63 | CBString str; 64 | 65 | if(i < m_arrayVariant.GetCount() && m_arrayVariant[i].vt == VT_BSTR) 66 | str = m_arrayVariant[i].bstrVal; 67 | 68 | return str; 69 | } 70 | 71 | void Sort(void); 72 | 73 | public: 74 | ULONG GetEnum(VARIANT *rgVar, ULONG pos, ULONG count) 75 | { 76 | ULONG i = 0; 77 | 78 | while(count > 0 && pos < (int)m_arrayVariant.GetCount()) 79 | { 80 | VariantCopy(rgVar, &m_arrayVariant[pos]); 81 | count --; 82 | pos ++; 83 | rgVar ++; 84 | i ++; 85 | } 86 | 87 | return i; 88 | } 89 | 90 | protected: 91 | CAtlArray m_arrayVariant; 92 | }; 93 | 94 | -------------------------------------------------------------------------------- /BoxLib/BListEx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BStruct.h" 4 | #include "json.h" 5 | 6 | class __declspec(uuid("94650000-0000-0000-0000-00004C697374")) 7 | CBListEx : public CBDispatch 8 | { 9 | DECLARE_CLASS(CBListEx) 10 | 11 | public: 12 | // IPersist 13 | STDMETHOD(GetClassID)(CLSID *pClassID); 14 | 15 | public: 16 | // IPersistStream 17 | STDMETHOD(Load)(IStream *pStm); 18 | STDMETHOD(Save)(IStream *pStm, BOOL fClearDirty); 19 | 20 | public: 21 | // IPersistStreamInit 22 | STDMETHOD(InitNew)(void); 23 | 24 | public: 25 | // IVariantList 26 | STDMETHOD(get__NewEnum)(IUnknown **ppEnumReturn); 27 | STDMETHOD(get_Items)(VARIANT *pItemsArray); 28 | 29 | STDMETHOD(get_Count)(long *cStrRet); 30 | 31 | STDMETHOD(Add)(VARIANT var); 32 | STDMETHOD(Insert)(long i, VARIANT var); 33 | STDMETHOD(Remove)(long i); 34 | STDMETHOD(RemoveAll)(void); 35 | STDMETHOD(Sort)(VARIANT_BOOL bMode = -1); 36 | STDMETHOD(Join)(BSTR bstrDelimiter, BSTR* pvar); 37 | STDMETHOD(Split)(BSTR bstrExpression, BSTR bstrDelimiter); 38 | 39 | STDMETHOD(toJson)(int intStyle, BSTR* pvar); 40 | STDMETHOD(fromJson)(BSTR bstrJson); 41 | 42 | public: 43 | ULONG GetEnum(VARIANT *rgVar, ULONG pos, ULONG count) 44 | { 45 | ULONG i = 0; 46 | 47 | m_cs.Enter(); 48 | while(count > 0 && pos < (int)m_arrayVariant.GetCount()) 49 | { 50 | VariantCopy(rgVar, &m_arrayVariant[pos]); 51 | count --; 52 | pos ++; 53 | rgVar ++; 54 | i ++; 55 | } 56 | m_cs.Leave(); 57 | 58 | return i; 59 | } 60 | 61 | }; 62 | 63 | -------------------------------------------------------------------------------- /BoxLib/BMessageManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BCollection.h" 4 | 5 | class __declspec(uuid("94650000-0000-4D73-674D-616E61676572")) 6 | CBMessageManager : public CBDispatch 7 | { 8 | DECLARE_CLASS(CBMessageManager) 9 | 10 | public: 11 | class CColl : public CBDispatch 12 | { 13 | public: 14 | // IMessageManager 15 | STDMETHOD(GetMessage)(BSTR bstrKey, BSTR *bstrMessage); 16 | STDMETHOD(FormatMessage)(BSTR bstrKey, BSTR bstr1, BSTR bstr2, BSTR bstr3, BSTR bstr4, BSTR bstr5, BSTR bstr6, BSTR bstr7, BSTR bstr8, BSTR *bstrMessage); 17 | STDMETHOD(AddMessage)(BSTR bstrKey, BSTR bstrMessage); 18 | STDMETHOD(RemoveMessage)(BSTR bstrKey); 19 | STDMETHOD(get_Language)(BSTR *pVal); 20 | STDMETHOD(get_CodePage)(long *pCodePage); 21 | STDMETHOD(get_Count)(long *cStrRet); 22 | STDMETHOD(get_Names)(VARIANT *pItemsArray); 23 | STDMETHOD(get_Messages)(VARIANT *pItemsArray); 24 | 25 | CBString GetMessage(LPCWSTR bstrKey); 26 | public: 27 | CBCriticalSection m_cs; 28 | CRBMap m_mapMessage; 29 | CBString m_strLanguage; 30 | long m_nCodePage; 31 | }; 32 | 33 | public: 34 | template 35 | void GetLanguages(CAtlArray &array) 36 | { 37 | POSITION pos; 38 | 39 | CBLock l(&m_cs); 40 | 41 | pos = m_mapLang.GetHeadPosition(); 42 | while(pos) 43 | { 44 | array.Add(((CRBMap >::CPair*)pos)->m_key.m_str); 45 | m_mapLang.GetNext(pos); 46 | } 47 | 48 | l.Unlock(); 49 | } 50 | 51 | void GetLanguage(LPCWSTR bstrLanguage, CColl** pMessageColl); 52 | 53 | public: 54 | // IMessageManager 55 | STDMETHOD(GetLanguage)(BSTR bstrLanguage, IMessageColl** pMessageColl); 56 | STDMETHOD(AddLanguage)(BSTR bstrLanguage, long CodePage, IMessageColl** pMessageColl); 57 | STDMETHOD(RemoveLanguage)(BSTR bstrLanguage); 58 | STDMETHOD(get_Count)(long *cStrRet); 59 | STDMETHOD(get_Languages)(VARIANT *pItemsArray); 60 | STDMETHOD(Load)(VARIANT VarSrc); 61 | STDMETHOD(Save)(VARIANT VarDesc); 62 | 63 | private: 64 | CBCriticalSection m_cs; 65 | CRBMap > m_mapLang; 66 | }; 67 | -------------------------------------------------------------------------------- /BoxLib/BNoUrl.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | 3 | HRESULT GetBoxStream(LPCWSTR bstrFile, IStream **ppStream) 4 | { 5 | return E_NOTIMPL; 6 | } 7 | 8 | extern "C" HANDLE __stdcall NewCreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) 9 | { 10 | return CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); 11 | } 12 | 13 | extern "C" HANDLE __stdcall NewCreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) 14 | { 15 | return CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); 16 | } 17 | -------------------------------------------------------------------------------- /BoxLib/BPipe.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "BPipe.h" 3 | #include "BVarType.h" 4 | 5 | // IBaseStream 6 | 7 | STDMETHODIMP CBPipe::get_lastModify(DATE *pVal) 8 | { 9 | return E_NOTIMPL; 10 | } 11 | 12 | STDMETHODIMP CBPipe::get_Position(DOUBLE *pVal) 13 | { 14 | return E_NOTIMPL; 15 | } 16 | 17 | STDMETHODIMP CBPipe::put_Position(DOUBLE newVal) 18 | { 19 | return E_NOTIMPL; 20 | } 21 | 22 | STDMETHODIMP CBPipe::get_Size(DOUBLE *pVal) 23 | { 24 | return E_NOTIMPL; 25 | } 26 | 27 | STDMETHODIMP CBPipe::put_Size(DOUBLE newVal) 28 | { 29 | return E_NOTIMPL; 30 | } 31 | 32 | STDMETHODIMP CBPipe::Open(long nSize) 33 | { 34 | return E_NOTIMPL; 35 | } 36 | 37 | STDMETHODIMP CBPipe::Attach(IUnknown *SrcStream) 38 | { 39 | return E_NOTIMPL; 40 | } 41 | 42 | STDMETHODIMP CBPipe::setEOS(void) 43 | { 44 | return E_NOTIMPL; 45 | } 46 | 47 | STDMETHODIMP CBPipe::Flush(void) 48 | { 49 | return E_NOTIMPL; 50 | } 51 | 52 | STDMETHODIMP CBPipe::get_EOS(VARIANT_BOOL *pEOS) 53 | { 54 | DWORD dwAvail = 0; 55 | 56 | if (PeekNamedPipe(m_hFile, NULL, 0, NULL, &dwAvail, NULL)) 57 | *pEOS = VARIANT_FALSE; 58 | else 59 | *pEOS = VARIANT_TRUE; 60 | return S_OK; 61 | } 62 | 63 | // IPipe 64 | 65 | STDMETHODIMP CBPipe::get_dataAvailable(long *pVal) 66 | { 67 | DWORD dwAvail = 0; 68 | 69 | if (PeekNamedPipe(m_hFile, NULL, 0, NULL, &dwAvail, NULL)) 70 | *pVal = (long)dwAvail; 71 | else 72 | *pVal = 0; 73 | return S_OK; 74 | } 75 | 76 | STDMETHODIMP CBPipe::Open(long nSize, IPipe** retVal) 77 | { 78 | Close(); 79 | 80 | SECURITY_ATTRIBUTES saAttr; 81 | saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); 82 | saAttr.bInheritHandle = TRUE; 83 | saAttr.lpSecurityDescriptor = NULL; 84 | 85 | CHandle hRd; 86 | if (!CreatePipe(&hRd.m_h, &m_hFile.m_h, &saAttr, nSize)) 87 | return HRESULT_FROM_WIN32(GetLastError()); 88 | m_dwType = STGTY_STREAM; 89 | 90 | CBComPtr pPipe; 91 | pPipe.CreateInstance(); 92 | pPipe->SetHandle(hRd.Detach(), STGTY_STREAM); 93 | return pPipe.QueryInterface(retVal); 94 | } 95 | 96 | -------------------------------------------------------------------------------- /BoxLib/BPipe.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BStream.h" 4 | 5 | class __declspec(uuid("94650000-0000-0000-0000-000050697065")) 6 | CBPipe : public CBDispatch 7 | { 8 | DECLARE_CLASS_EX(CBPipe, CBStream) 9 | 10 | public: 11 | // IBaseStream 12 | STDMETHOD(get_EOS)(VARIANT_BOOL *pEOS); 13 | 14 | STDMETHOD(get_lastModify)(DATE *pVal); 15 | STDMETHOD(get_Position)(DOUBLE *pVal); 16 | STDMETHOD(put_Position)(DOUBLE newVal); 17 | STDMETHOD(get_Size)(DOUBLE *pVal); 18 | STDMETHOD(put_Size)(DOUBLE newVal); 19 | 20 | STDMETHOD(Open)(long nSize); 21 | STDMETHOD(Attach)(IUnknown *SrcStream); 22 | STDMETHOD(setEOS)(void); 23 | STDMETHOD(Flush)(void); 24 | 25 | public: 26 | // IPipe 27 | STDMETHOD(Open)(long nSize, IPipe** retVal); 28 | STDMETHOD(get_dataAvailable)(long *pVal); 29 | 30 | }; 31 | 32 | -------------------------------------------------------------------------------- /BoxLib/BPipeLine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BStream.h" 4 | 5 | #define MAX_PIPE_BLOCK_SIZE 1024 6 | 7 | class __declspec(uuid("94650000-0000-0042-5069-70654C696E65")) 8 | CBPipeLine : public CBDispatch 9 | { 10 | private: 11 | class CBPipeDate : public CBObject 12 | { 13 | public: 14 | CBPipeDate(UINT size) 15 | { 16 | m_ulMaxBlock = (size + MAX_PIPE_BLOCK_SIZE - 1) / MAX_PIPE_BLOCK_SIZE; 17 | 18 | m_semRead.Create(0, m_ulMaxBlock + 1); 19 | m_semWrite.Create(m_ulMaxBlock, m_ulMaxBlock + 1); 20 | 21 | m_ulWritePos = MAX_PIPE_BLOCK_SIZE; 22 | m_ulReadPos = 0; 23 | } 24 | 25 | ~CBPipeDate() 26 | { 27 | while(m_pBuffers.GetCount()) 28 | delete m_pBuffers.RemoveHead(); 29 | } 30 | 31 | public: 32 | ULONG Read(void* pv, ULONG cb); 33 | ULONG Write(void const* pv, ULONG cb); 34 | ULONG dataAvailable(void); 35 | void Stop() 36 | { 37 | m_semRead.Release(); 38 | m_semWrite.Release(); 39 | } 40 | 41 | private: 42 | CAtlList< LPBYTE > m_pBuffers; 43 | ULONG m_ulWritePos, m_ulReadPos, m_ulMaxBlock; 44 | CBCriticalSection m_cs; 45 | CBSemaphore m_semRead, m_semWrite; 46 | }; 47 | 48 | DECLARE_CLASS_EX(CBPipeLine, CBStream) 49 | 50 | public: 51 | ~CBPipeLine(void); 52 | 53 | public: 54 | // IBaseStream 55 | STDMETHOD(Attach)(IUnknown *SrcStream); 56 | STDMETHOD(Open)(long nSize); 57 | STDMETHOD(Close)(void); 58 | 59 | public: 60 | // IPipeLine 61 | STDMETHOD(Open)(long nSize, IPipeLine** retVal); 62 | STDMETHOD(get_dataAvailable)(long *pVal); 63 | 64 | protected: 65 | virtual HRESULT InternalRead(void *pv, ULONG cb, ULONG *pcbRead); 66 | virtual HRESULT InternalWrite(const void *pv, ULONG cb, ULONG *pcbWritten); 67 | virtual HRESULT InternalEOS(VARIANT_BOOL *pEOS); 68 | 69 | private: 70 | CBComPtr m_pInput; 71 | CBComPtr m_pOutput; 72 | }; 73 | -------------------------------------------------------------------------------- /BoxLib/BProcess.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "BPipe.h" 3 | 4 | class __declspec(uuid("94650000-0000-0000-0050-726F63657373")) 5 | 6 | CBProcess : public CBDispatch 7 | { 8 | DECLARE_CLASS(CBProcess) 9 | 10 | public: 11 | CBProcess(void); 12 | ~CBProcess(void); 13 | 14 | public: 15 | STDMETHOD(get_ExitCode)(LONG *newVal); 16 | STDMETHOD(get_ProcessID)(LONG *newVal); 17 | STDMETHOD(get_Status)(LONG *newVal); 18 | STDMETHOD(get_FileName)(BSTR *newVal); 19 | 20 | STDMETHOD(Terminate)(); 21 | 22 | STDMETHOD(get_StdIn)(IPipe** ppStream); 23 | STDMETHOD(get_StdOut)(IPipe** ppStream); 24 | STDMETHOD(get_StdErr)(IPipe** ppStream); 25 | 26 | void SetHandle(HANDLE hProcess, HANDLE hStdIn = NULL, HANDLE hStdOut = NULL, HANDLE hStdErr = NULL); 27 | private: 28 | CHandle m_hProcess; 29 | 30 | CBComPtr m_pPipe_StdIn; 31 | CBComPtr m_pPipe_StdOut; 32 | CBComPtr m_pPipe_StdErr; 33 | }; 34 | -------------------------------------------------------------------------------- /BoxLib/BQueue.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BVariant.h" 4 | #include "BThread.h" 5 | 6 | class __declspec(uuid("94650000-0000-0000-0000-005175657565")) 7 | CBQueue : public CBDispatch, 8 | public IPersistStreamInit 9 | { 10 | DECLARE_CLASS(CBQueue) 11 | 12 | INTERFACE_BEGIN_EX(CBDispatch) 13 | PERSIST_INTERFACE 14 | INTERFACE_END 15 | 16 | public: 17 | ~CBQueue(void) 18 | { 19 | RemoveAll(); 20 | } 21 | 22 | public: 23 | // IPersist 24 | STDMETHOD(GetClassID)(CLSID *pClassID); 25 | 26 | public: 27 | // IPersistStream 28 | STDMETHOD(IsDirty)(void); 29 | STDMETHOD(Load)(IStream *pStm); 30 | STDMETHOD(Save)(IStream *pStm, BOOL fClearDirty); 31 | STDMETHOD(GetSizeMax)(ULARGE_INTEGER *pcbSize); 32 | 33 | public: 34 | // IPersistStreamInit 35 | STDMETHOD(InitNew)(void); 36 | 37 | public: 38 | // IQueue 39 | STDMETHOD(get_Item)(VARIANT *pvar); 40 | STDMETHOD(get_Count)(long *cStrRet); 41 | STDMETHOD(get_Items)(VARIANT *pItemsArray); 42 | 43 | STDMETHOD(AddHead)(VARIANT var); 44 | STDMETHOD(AddTail)(VARIANT var); 45 | STDMETHOD(GetHead)(VARIANT *var); 46 | STDMETHOD(GetTail)(VARIANT *var); 47 | STDMETHOD(RemoveHead)(VARIANT *var); 48 | STDMETHOD(RemoveTail)(VARIANT *var); 49 | STDMETHOD(RemoveAll)(void); 50 | STDMETHOD(Load)(VARIANT VarSrc, short mode = 7); 51 | STDMETHOD(Save)(VARIANT VarDesc, short mode = 7); 52 | STDMETHOD(Join)(BSTR bstrDelimiter, BSTR* pvar); 53 | STDMETHOD(Split)(BSTR bstrExpression, BSTR bstrDelimiter); 54 | 55 | private: 56 | CBCriticalSection m_cs; 57 | CAtlList m_listItems; 58 | }; 59 | 60 | -------------------------------------------------------------------------------- /BoxLib/BRSA.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class __declspec(uuid("94650000-0000-0000-0000-000000525341")) 4 | CBRSA : public CBDispatch 5 | { 6 | DECLARE_CLASS(CBRSA) 7 | APARTMENT_MODE 8 | 9 | public: 10 | CBRSA(void) : m_pRSA(NULL), m_nPadding(1) 11 | {} 12 | 13 | ~CBRSA(void) 14 | { 15 | free(); 16 | } 17 | 18 | public: 19 | STDMETHOD(get_IsPrivateKey)(VARIANT_BOOL *pVal); 20 | STDMETHOD(get_Key)(VARIANT *pVal); 21 | STDMETHOD(get_KeySize)(short *pVal); 22 | STDMETHOD(get_Padding)(short *pVal); 23 | STDMETHOD(put_Padding)(short newVal); 24 | STDMETHOD(get_PrivateKey)(VARIANT *pVal); 25 | STDMETHOD(put_PrivateKey)(VARIANT newVal); 26 | STDMETHOD(get_PublicKey)(VARIANT *pVal); 27 | STDMETHOD(put_PublicKey)(VARIANT newVal); 28 | STDMETHOD(Decrypt)(VARIANT varData, VARIANT *pVal); 29 | STDMETHOD(Encrypt)(VARIANT varData, VARIANT *pVal); 30 | STDMETHOD(GenerateKey)(VARIANT varSize = VARIANT_ERROR); 31 | 32 | private: 33 | void *m_pRSA; 34 | short m_nPadding; 35 | 36 | void free(void); 37 | }; 38 | -------------------------------------------------------------------------------- /BoxLib/BRandom.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "BRandom.h" 3 | #include "BVarType.h" 4 | #include 5 | 6 | STDMETHODIMP CBRandom::Generate(short nSize, VARIANT* pvar) 7 | { 8 | CBVarPtr varPtr; 9 | HRESULT hr; 10 | 11 | hr = varPtr.Create(nSize); 12 | if(FAILED(hr))return hr; 13 | 14 | RAND_bytes(varPtr.m_pData, nSize); 15 | 16 | return varPtr.GetVariant(pvar); 17 | } 18 | 19 | -------------------------------------------------------------------------------- /BoxLib/BRandom.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class __declspec(uuid("94650000-0000-0000-0000-52616E646F6D")) 4 | CBRandom : public CBDispatch 5 | { 6 | DECLARE_CLASS(CBRandom) 7 | APARTMENT_MODE 8 | 9 | public: 10 | STDMETHOD(Generate)(short nSize, VARIANT* pvar); 11 | }; 12 | 13 | -------------------------------------------------------------------------------- /BoxLib/BShellLink.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | 7 | class __declspec(uuid("94650000-0000-0053-6865-6C6C4C696E6B")) 8 | CBShellLink : public CBDispatch 9 | { 10 | DECLARE_CLASS(CBShellLink) 11 | 12 | public: 13 | CBShellLink(); 14 | 15 | public: 16 | STDMETHOD(get_Arguments)(BSTR *pVal); 17 | STDMETHOD(put_Arguments)(BSTR Val); 18 | STDMETHOD(get_Description)(BSTR *pVal); 19 | STDMETHOD(put_Description)(BSTR Val); 20 | STDMETHOD(get_Hotkey)(int *pVal); 21 | STDMETHOD(put_Hotkey)(int Val); 22 | STDMETHOD(get_IconLocation)(BSTR *pVal); 23 | STDMETHOD(put_IconLocation)(BSTR Val); 24 | STDMETHOD(get_IDList)(BSTR *pVal); 25 | STDMETHOD(put_IDList)(BSTR Val); 26 | STDMETHOD(get_Path)(BSTR *pVal); 27 | STDMETHOD(put_Path)(BSTR Val); 28 | STDMETHOD(get_ShowCmd)(int *pVal); 29 | STDMETHOD(put_ShowCmd)(int Val); 30 | STDMETHOD(get_WorkingDirectory)(BSTR *pVal); 31 | STDMETHOD(put_WorkingDirectory)(BSTR Val); 32 | 33 | STDMETHOD(Load)(BSTR strFileName); 34 | STDMETHOD(Save)(BSTR strFileName); 35 | STDMETHOD(Resolve)(int hWnd, int dwFlag); 36 | 37 | private: 38 | CComPtr m_sl; 39 | }; 40 | 41 | -------------------------------------------------------------------------------- /BoxLib/BSimpleDictionary.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "BSimpleDictionary.h" 3 | 4 | STDMETHODIMP CBSimpleDictionary::get_Item(VARIANT VarKey, VARIANT *pVariantReturn) 5 | { 6 | HRESULT hr; 7 | 8 | m_cs.Enter(); 9 | hr = m_dict.get_Item(VarKey, pVariantReturn); 10 | m_cs.Leave(); 11 | 12 | return hr; 13 | } 14 | 15 | STDMETHODIMP CBSimpleDictionary::get__NewEnum(IUnknown **ppEnumReturn) 16 | { 17 | HRESULT hr; 18 | 19 | m_cs.Enter(); 20 | hr = getNewEnum(this, ppEnumReturn); 21 | m_cs.Leave(); 22 | 23 | return hr; 24 | } 25 | 26 | STDMETHODIMP CBSimpleDictionary::get_Count(long *cStrRet) 27 | { 28 | m_cs.Enter(); 29 | *cStrRet = (long)m_dict.GetCount(); 30 | m_cs.Leave(); 31 | 32 | return S_OK; 33 | } 34 | 35 | STDMETHODIMP CBSimpleDictionary::get_Key(VARIANT VarKey, VARIANT *pvar) 36 | { 37 | HRESULT hr; 38 | 39 | m_cs.Enter(); 40 | hr = m_dict.get_Key(VarKey, pvar); 41 | m_cs.Leave(); 42 | 43 | return hr; 44 | } 45 | 46 | STDMETHODIMP CBSimpleDictionary::Exists(VARIANT VarKey, VARIANT_BOOL *pExists) 47 | { 48 | HRESULT hr; 49 | 50 | m_cs.Enter(); 51 | hr = m_dict.Exists(VarKey, pExists); 52 | m_cs.Leave(); 53 | 54 | return hr; 55 | } 56 | 57 | STDMETHODIMP CBSimpleDictionary::get_Items(VARIANT *pItemsArray) 58 | { 59 | HRESULT hr; 60 | 61 | m_cs.Enter(); 62 | hr = m_dict.get_Items(pItemsArray); 63 | m_cs.Leave(); 64 | 65 | return hr; 66 | } 67 | 68 | STDMETHODIMP CBSimpleDictionary::get_Keys(VARIANT *pKeysArray) 69 | { 70 | HRESULT hr; 71 | 72 | m_cs.Enter(); 73 | hr = m_dict.get_Keys(pKeysArray); 74 | m_cs.Leave(); 75 | 76 | return hr; 77 | } 78 | 79 | -------------------------------------------------------------------------------- /BoxLib/BSimpleDictionary.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BCollection.h" 4 | 5 | class __declspec(uuid("94650000-6C65-4469-6374-696F6E617279")) 6 | CBSimpleDictionary : public CBDispatch 7 | { 8 | DECLARE_CLASS(CBSimpleDictionary) 9 | 10 | public: 11 | // IRequestDictionary 12 | STDMETHOD(get_Item)(VARIANT VarKey, VARIANT *pVariantReturn); 13 | STDMETHOD(get__NewEnum)(IUnknown **ppEnumReturn); 14 | STDMETHOD(get_Count)(long *cStrRet); 15 | STDMETHOD(get_Key)(VARIANT VarKey, VARIANT *pvar); 16 | 17 | STDMETHOD(Exists)(VARIANT VarKey, VARIANT_BOOL *pExists); 18 | 19 | STDMETHOD(get_Items)(VARIANT *pItemsArray); 20 | STDMETHOD(get_Keys)(VARIANT *pKeysArray); 21 | 22 | public: 23 | ULONG GetEnum(VARIANT *rgVar, ULONG pos, ULONG count) 24 | { 25 | m_cs.Enter(); 26 | ULONG ulRet = m_dict.GetEnum(rgVar, pos, count); 27 | m_cs.Leave(); 28 | 29 | return ulRet; 30 | } 31 | 32 | template 33 | void AddValue(CBString strKey, const TYPE& value) 34 | { 35 | m_cs.Enter(); 36 | m_dict[strKey] = value; 37 | m_cs.Leave(); 38 | } 39 | 40 | void RemoveValue(CBString strKey) 41 | { 42 | m_cs.Enter(); 43 | m_dict.Remove(strKey); 44 | m_cs.Leave(); 45 | } 46 | 47 | void RemoveAll(void) 48 | { 49 | m_cs.Enter(); 50 | m_dict.RemoveAll(); 51 | m_cs.Leave(); 52 | } 53 | 54 | void Sort() 55 | { 56 | m_cs.Enter(); 57 | m_dict.Sort(); 58 | m_cs.Leave(); 59 | } 60 | 61 | protected: 62 | CBDict m_dict; 63 | CBCriticalSection m_cs; 64 | }; 65 | 66 | -------------------------------------------------------------------------------- /BoxLib/BStruct.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BCollection.h" 4 | #include "json.h" 5 | 6 | class __declspec(uuid("94650000-0000-0000-0042-537472756374")) 7 | CBStruct : public CBDispatch, 8 | public IPersistStreamInit, 9 | public IJSON 10 | { 11 | DECLARE_CLASS(CBStruct) 12 | 13 | INTERFACE_BEGIN_EX(CBDispatch) 14 | PERSIST_INTERFACE 15 | INTERFACE_DEF(IJSON) 16 | INTERFACE_END 17 | 18 | public: 19 | class CBStructFactory : public CBClass 20 | { 21 | private: 22 | class CBStructTypeInfo : public CBTypeInfo 23 | { 24 | public: 25 | CLSID Init(LPCWSTR pstrName, LPCWSTR pstrInit); 26 | 27 | STDMETHOD(Invoke)(PVOID pvInstance, MEMBERID memid, WORD wFlags, DISPPARAMS *pDispParams, 28 | VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr); 29 | 30 | public: 31 | CAtlArray m_arrarName; 32 | CAtlArray m_arrayMethod; 33 | }; 34 | 35 | public: 36 | CBStructFactory(LPCWSTR pstrName, LPCWSTR pstrInit); 37 | public: 38 | // IClassFactory 39 | STDMETHOD(CreateInstance)(LPUNKNOWN pUnkOuter, REFIID riid, void** ppvObj); 40 | STDMETHOD(LockServer)(BOOL fLock) 41 | { 42 | return S_OK; 43 | } 44 | 45 | CLSID m_clsid; 46 | CBComPtr m_pTypeInfo; 47 | }; 48 | 49 | public: 50 | CBStruct(void) 51 | {} 52 | 53 | ~CBStruct(void); 54 | 55 | public: 56 | // IJSON 57 | STDMETHOD(JSON_join)( IStream *pStrm, int indent, CAtlArray &arrObjects); 58 | STDMETHOD(JSON_split)( _parser* p ); 59 | 60 | public: 61 | // IPersist 62 | STDMETHOD(GetClassID)(CLSID *pClassID); 63 | 64 | public: 65 | // IPersistStream 66 | STDMETHOD(IsDirty)(void); 67 | STDMETHOD(Load)(IStream *pStm); 68 | STDMETHOD(Save)(IStream *pStm, BOOL fClearDirty); 69 | STDMETHOD(GetSizeMax)(ULARGE_INTEGER *pcbSize); 70 | 71 | public: 72 | // IPersistStreamInit 73 | STDMETHOD(InitNew)(void); 74 | 75 | public: 76 | // IVariantStruct 77 | STDMETHOD(get_Item)(long id, VARIANT *pvar); 78 | STDMETHOD(put_Item)(long id, VARIANT pvar); 79 | STDMETHOD(putref_Item)(long id, VARIANT pvar); 80 | 81 | STDMETHOD(Load)(VARIANT VarSrc, short mode = 7); 82 | STDMETHOD(Save)(VARIANT VarDesc, short mode = 7); 83 | 84 | 85 | void setCount(UINT n) 86 | { 87 | m_arrayVariant.SetCount(n); 88 | ZeroMemory(&m_arrayVariant[0], sizeof(VARIANT) * n); 89 | } 90 | 91 | private: 92 | void ClearAll(void); 93 | 94 | protected: 95 | CBCriticalSection m_cs; 96 | CAtlArray m_arrayVariant; 97 | }; 98 | -------------------------------------------------------------------------------- /BoxLib/BThread.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "BThread.h" 3 | 4 | static __declspec(thread) CBThread* th_pThread; 5 | static CBTLSBase* s_pTlsLink; 6 | static UINT s_nTlsSize; 7 | 8 | CBTLSBase::CBTLSBase(void) : m_pNext(s_pTlsLink), m_nPos(s_nTlsSize) 9 | { 10 | s_pTlsLink = this; 11 | } 12 | 13 | void CBTLSBase::Init(CBThread* pThread) 14 | { 15 | } 16 | 17 | void CBTLSBase::Exit(CBThread* pThread) 18 | { 19 | } 20 | 21 | void CBTLSBase::Alloc(UINT nSize) 22 | { 23 | s_nTlsSize += nSize; 24 | } 25 | 26 | void* CBTLSBase::GetPtr(CBThread* pThread) const throw() 27 | { 28 | if(!pThread)pThread = CBThread::GetThread(); 29 | 30 | if(!pThread)return NULL; 31 | 32 | return &pThread->m_pTLS[m_nPos]; 33 | } 34 | 35 | CBThread::CBThread(void) 36 | { 37 | th_pThread = this; 38 | m_pTLS.Allocate(m_nSize = s_nTlsSize); 39 | ZeroMemory(m_pTLS, m_nSize); 40 | 41 | CBTLSBase* m_pLink = s_pTlsLink; 42 | 43 | while(m_pLink) 44 | { 45 | m_pLink->Init(this); 46 | m_pLink = m_pLink->m_pNext; 47 | } 48 | } 49 | 50 | CBThread::~CBThread(void) 51 | { 52 | th_pThread = NULL; 53 | CBTLSBase* m_pLink = s_pTlsLink; 54 | 55 | while(m_pLink) 56 | { 57 | m_pLink->Exit(this); 58 | m_pLink = m_pLink->m_pNext; 59 | } 60 | } 61 | 62 | CBThread* CBThread::GetThread(void) 63 | { 64 | return th_pThread; 65 | } 66 | 67 | CBThread** CBThread::GetThreadID(void) 68 | { 69 | return &th_pThread; 70 | } 71 | -------------------------------------------------------------------------------- /BoxLib/BUDPSocket.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BThread.h" 4 | 5 | class __declspec(uuid("94650000-0043-4255-4450-536F636B6574")) 6 | CBUDPSocket : public CBDispatch 7 | { 8 | DECLARE_CLASS(CBUDPSocket) 9 | 10 | public: 11 | CBUDPSocket(void); 12 | ~CBUDPSocket(void); 13 | 14 | class __declspec(uuid("94659465-0000-0055-4450-5061636B6574")) 15 | CBUDPPacket : public CBDispatch 16 | { 17 | DECLARE_CLASS(CBUDPPacket) 18 | 19 | public: 20 | // IUDPPacket 21 | STDMETHOD(get_Data)(VARIANT *pVal); 22 | STDMETHOD(get_LocalAddress)(BSTR *pVal); 23 | STDMETHOD(get_LocalPort)(LONG *pVal); 24 | STDMETHOD(get_RemoteAddress)(BSTR *pVal); 25 | STDMETHOD(get_RemotePort)(LONG *pVal); 26 | 27 | public: 28 | CComVariant m_varData; 29 | CBString m_strLocalAddr; 30 | long m_nLocalPort; 31 | CBString m_strRemoteAddr; 32 | long m_nRemotePort; 33 | }; 34 | 35 | // IUDPSocket 36 | STDMETHOD(Bind)(BSTR strAddr, LONG port); 37 | STDMETHOD(SendTo)(BSTR strAddr, LONG port, VARIANT varData); 38 | STDMETHOD(RecvFrom)(IUDPPacket **pVal); 39 | STDMETHOD(Close)(void); 40 | 41 | STDMETHOD(get_LocalAddress)(BSTR *pVal); 42 | STDMETHOD(get_LocalPort)(LONG *pVal); 43 | STDMETHOD(get_PacketSize)(LONG *pVal); 44 | STDMETHOD(put_PacketSize)(LONG newVal); 45 | STDMETHOD(get_ReceiveTimeout)(LONG *pVal); 46 | STDMETHOD(put_ReceiveTimeout)(LONG newVal); 47 | STDMETHOD(get_BroadCast)(VARIANT_BOOL *pVal); 48 | STDMETHOD(put_BroadCast)(VARIANT_BOOL newVal); 49 | 50 | private: 51 | void GetLocalInfo(void); 52 | HRESULT FillAddress(BSTR strAddr, LONG port, SOCKADDR_IN* sockAddr); 53 | 54 | CBCriticalSection m_cs; 55 | SOCKET m_hSocket; 56 | CBString m_strAddr; 57 | long m_nPort; 58 | 59 | CBCriticalSection m_csBuffer; 60 | long m_nPacketSize; 61 | CBAutoPtr m_pBuffer; 62 | }; 63 | -------------------------------------------------------------------------------- /BoxLib/BUrlStream.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include ".\burlstream.h" 3 | 4 | HRESULT GetBoxStream(BSTR bstrFile, IStream **ppStream); 5 | 6 | HRESULT CBUrlStream::Open(BSTR bstrUrl) 7 | { 8 | Close(); 9 | 10 | if(!wcsnicmp(bstrUrl, L"netbox:/", 8)) 11 | return GetBoxStream(bstrUrl + 7, &m_pStream); 12 | 13 | return URLOpenBlockingStream(NULL, CString(bstrUrl), &m_pStream, 0, NULL); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /BoxLib/BUrlStream.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BStream.h" 4 | 5 | class __declspec(uuid("94650000-0000-0055-726C-53747265616D")) 6 | CBUrlStream : public CBDispatchEx 7 | { 8 | DECLARE_CLASS_EX(CBUrlStream, CBStream) 9 | 10 | public: 11 | // IUrlStream 12 | STDMETHOD(Open)(BSTR bstrUrl); 13 | }; 14 | -------------------------------------------------------------------------------- /BoxLib/BoxLib.vcproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "relative:BoxLib" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /BoxLib/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | STATIC LIBRARY : BoxLib Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this BoxLib library project for you. 6 | This file contains a summary of what you will find in each of the files that 7 | make up your BoxLib application. 8 | 9 | 10 | BoxLib.vcproj 11 | This is the main project file for VC++ projects generated using an Application Wizard. 12 | It contains information about the version of Visual C++ that generated the file, and 13 | information about the platforms, configurations, and project features selected with the 14 | Application Wizard. 15 | 16 | 17 | ///////////////////////////////////////////////////////////////////////////// 18 | 19 | StdAfx.h, StdAfx.cpp 20 | These files are used to build a precompiled header (PCH) file 21 | named BoxLib.pch and a precompiled types file named StdAfx.obj. 22 | 23 | ///////////////////////////////////////////////////////////////////////////// 24 | Other notes: 25 | 26 | AppWizard uses "TODO:" comments to indicate parts of the source code you 27 | should add to or customize. 28 | 29 | ///////////////////////////////////////////////////////////////////////////// 30 | -------------------------------------------------------------------------------- /BoxLib/blib.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "BoxLib_i.c" 3 | -------------------------------------------------------------------------------- /BoxLib/crc16.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef struct CRC16TIstate_st 4 | { 5 | unsigned short crc; 6 | }CRC16TI_CTX; 7 | 8 | int CRC16TI_Init(CRC16TI_CTX *c) 9 | { 10 | c->crc = 0xFFFF; 11 | return 0; 12 | } 13 | 14 | int CRC16TI_Update(CRC16TI_CTX *c, const unsigned char *p, size_t len) 15 | { 16 | unsigned short crc = c->crc; 17 | for (size_t i = 0; i < len; i++) { 18 | unsigned char data = *p++; 19 | for (int j = 0; j < 8; j++) { 20 | if (((crc & 0x8000) >> 8) ^ (data & 0x80)) 21 | crc = (crc << 1) ^ 0x8005; 22 | else 23 | crc <<= 1; 24 | data <<= 1; 25 | } 26 | } 27 | c->crc = crc; 28 | return 0; 29 | } 30 | 31 | int CRC16TI_Final(unsigned char *md, CRC16TI_CTX *c) 32 | { 33 | *(unsigned short *)md = c->crc; 34 | return 0; 35 | } 36 | 37 | -------------------------------------------------------------------------------- /BoxLib/fmtHTML/fmtHTML.h: -------------------------------------------------------------------------------- 1 | // lex.h: lexer defines & declarations 2 | 3 | #ifndef _LEX_H_ 4 | #define _LEX_H_ 5 | 6 | #include 7 | 8 | // Function prototype 9 | int fht_lex (); 10 | void fht_exit(); 11 | 12 | #define ERROR_TOKEN 258 13 | #define SPACETEXT 259 14 | #define PLANTEXT 260 15 | #define TAG_ID 261 16 | #define TAG_STR 262 17 | #define TAG_START_ID 263 18 | #define TAG_CLOSE_ID 264 19 | #define STYLE_BEGIN 265 20 | #define STYLE_END 266 21 | #define STYLE_ID 267 22 | #define STYLE_VALUE 268 23 | 24 | #endif -------------------------------------------------------------------------------- /BoxLib/fmtHTML/fmtHTML.lex: -------------------------------------------------------------------------------- 1 | %{ 2 | 3 | #include "fmtHTML.h" 4 | 5 | #define isatty(p) 0 6 | 7 | void yyerror(char *msg); 8 | 9 | void fht_exit() 10 | { 11 | yy_delete_buffer(yy_current_buffer); 12 | } 13 | 14 | #undef YY_INPUT 15 | #define YY_INPUT(b, r, ms) (r = fht_input(b, ms)) 16 | 17 | extern int fht_input(char *buf, int ms); 18 | %} 19 | 20 | %x TAG_MODE STYLE_MODE SCRIPT_MODE COMMENT_MODE 21 | 22 | %% 23 | 24 | [ \t\r\n]+ { return SPACETEXT; } 25 | [^ \t\r\n<]* { return PLANTEXT; } 26 | 27 | "]*)?">" BEGIN SCRIPT_MODE; 28 | "]*)?">" BEGIN INITIAL; 29 | . ; 30 | \n ; 31 | 32 | "" BEGIN INITIAL; 34 | . ; 35 | \n ; 36 | 37 | "<"[a-z!][^ \t\r\n\"\'\\\/>=]* { BEGIN TAG_MODE; return TAG_START_ID; } 38 | "<"\/[a-z!][^ \t\r\n\"\'\\\/>=]* { BEGIN TAG_MODE; return TAG_CLOSE_ID; } 39 | = return yytext[0]; 40 | [ \t\r\n]+ ; 41 | style[ \t\r\n>=]*=[ \t\r\n>=]*[\"\'] BEGIN STYLE_MODE; return STYLE_BEGIN; 42 | [^ \t\r\n\"\'>=]+ return TAG_ID; 43 | \"[^\r\n\"]*\" return TAG_STR; 44 | \'[^\r\n\']*\' return TAG_STR; 45 | ">" BEGIN INITIAL; return yytext[0]; 46 | . ; 47 | 48 | [\r\n\"\'] BEGIN TAG_MODE; return STYLE_END; 49 | [ \t]+ ; 50 | [^ \t\r\n\"\'\:;]+ return STYLE_ID; 51 | \:[^\r\n\"\'\:;]+ return STYLE_VALUE; 52 | . ; 53 | 54 | "<" { return PLANTEXT; } 55 | 56 | %% 57 | -------------------------------------------------------------------------------- /BoxLib/jpeg/jchuff.h: -------------------------------------------------------------------------------- 1 | /* 2 | * jchuff.h 3 | * 4 | * Copyright (C) 1991-1997, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains declarations for Huffman entropy encoding routines 9 | * that are shared between the sequential encoder (jchuff.c) and the 10 | * progressive encoder (jcphuff.c). No other modules need to see these. 11 | */ 12 | 13 | /* The legal range of a DCT coefficient is 14 | * -1024 .. +1023 for 8-bit data; 15 | * -16384 .. +16383 for 12-bit data. 16 | * Hence the magnitude should always fit in 10 or 14 bits respectively. 17 | */ 18 | 19 | #if BITS_IN_JSAMPLE == 8 20 | #define MAX_COEF_BITS 10 21 | #else 22 | #define MAX_COEF_BITS 14 23 | #endif 24 | 25 | /* Derived data constructed for each Huffman table */ 26 | 27 | typedef struct { 28 | unsigned int ehufco[256]; /* code for each symbol */ 29 | char ehufsi[256]; /* length of code for each symbol */ 30 | /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */ 31 | } c_derived_tbl; 32 | 33 | /* Short forms of external names for systems with brain-damaged linkers. */ 34 | 35 | #ifdef NEED_SHORT_EXTERNAL_NAMES 36 | #define jpeg_make_c_derived_tbl jMkCDerived 37 | #define jpeg_gen_optimal_table jGenOptTbl 38 | #endif /* NEED_SHORT_EXTERNAL_NAMES */ 39 | 40 | /* Expand a Huffman table definition into the derived format */ 41 | EXTERN(void) jpeg_make_c_derived_tbl 42 | JPP((j_compress_ptr cinfo, boolean isDC, int tblno, 43 | c_derived_tbl ** pdtbl)); 44 | 45 | /* Generate an optimal table definition given the specified counts */ 46 | EXTERN(void) jpeg_gen_optimal_table 47 | JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])); 48 | -------------------------------------------------------------------------------- /BoxLib/jpeg/jconfig.h: -------------------------------------------------------------------------------- 1 | /* jconfig.bcc --- jconfig.h for Borland C (Turbo C) on MS-DOS or OS/2. */ 2 | /* see jconfig.doc for explanations */ 3 | 4 | #define HAVE_PROTOTYPES 5 | #define HAVE_UNSIGNED_CHAR 6 | #define HAVE_UNSIGNED_SHORT 7 | /* #define void char */ 8 | /* #define const */ 9 | #undef CHAR_IS_UNSIGNED 10 | #define HAVE_STDDEF_H 11 | #define HAVE_STDLIB_H 12 | #undef NEED_BSD_STRINGS 13 | #undef NEED_SYS_TYPES_H 14 | #ifdef __MSDOS__ 15 | #define NEED_FAR_POINTERS /* for small or medium memory model */ 16 | #endif 17 | #undef NEED_SHORT_EXTERNAL_NAMES 18 | #undef INCOMPLETE_TYPES_BROKEN /* this assumes you have -w-stu in CFLAGS */ 19 | 20 | /* Define "boolean" as unsigned char, not int, per Windows custom */ 21 | #ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ 22 | typedef unsigned char boolean; 23 | #endif 24 | #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ 25 | 26 | #ifdef JPEG_INTERNALS 27 | 28 | #undef RIGHT_SHIFT_IS_UNSIGNED 29 | 30 | #ifdef __MSDOS__ 31 | #define USE_MSDOS_MEMMGR /* Define this if you use jmemdos.c */ 32 | #define MAX_ALLOC_CHUNK 65520L /* Maximum request to malloc() */ 33 | #define USE_FMEM /* Borland has _fmemcpy() and _fmemset() */ 34 | #endif 35 | 36 | #endif /* JPEG_INTERNALS */ 37 | 38 | #ifdef JPEG_CJPEG_DJPEG 39 | 40 | #define BMP_SUPPORTED /* BMP image file format */ 41 | #define GIF_SUPPORTED /* GIF image file format */ 42 | #define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ 43 | #undef RLE_SUPPORTED /* Utah RLE image file format */ 44 | #define TARGA_SUPPORTED /* Targa image file format */ 45 | 46 | #define TWO_FILE_COMMANDLINE 47 | #define USE_SETMODE /* Borland has setmode() */ 48 | #ifdef __MSDOS__ 49 | #define NEED_SIGNAL_CATCHER /* Define this if you use jmemdos.c */ 50 | #endif 51 | #undef DONT_USE_B_MODE 52 | #undef PROGRESS_REPORT /* optional */ 53 | 54 | #endif /* JPEG_CJPEG_DJPEG */ 55 | -------------------------------------------------------------------------------- /BoxLib/jpeg/jversion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * jversion.h 3 | * 4 | * Copyright (C) 1991-1998, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains software version identification. 9 | */ 10 | 11 | 12 | #define JVERSION "6b 27-Mar-1998" 13 | 14 | #define JCOPYRIGHT "Copyright (C) 1998, Thomas G. Lane" 15 | -------------------------------------------------------------------------------- /BoxLib/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // BoxLib.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /BoxLib/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | 9 | #ifndef VC_EXTRALEAN 10 | #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers 11 | #endif 12 | 13 | // Modify the following defines if you have to target a platform prior to the ones specified below. 14 | // Refer to MSDN for the latest info on corresponding values for different platforms. 15 | #ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later. 16 | #define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. 17 | #endif 18 | 19 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later. 20 | #define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. 21 | #endif 22 | 23 | #ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. 24 | #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. 25 | #endif 26 | 27 | #ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later. 28 | #define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later. 29 | #endif 30 | 31 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit 32 | 33 | // turns off MFC's hiding of some common and often safely ignored warning messages 34 | #define _AFX_ALL_WARNINGS 35 | 36 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 37 | 38 | #ifdef _DEBUG 39 | #include 40 | #define new DEBUG_NEW 41 | #endif 42 | 43 | #pragma comment(lib, "..\\..\\openssl\\out32\\libeay32.lib") 44 | #pragma comment(lib, "..\\..\\openssl\\out32\\ssleay32.lib") 45 | 46 | // TODO: reference additional headers your program requires here 47 | 48 | #include "BoxLib.h" 49 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiIArguments.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "ti.h" 3 | 4 | static ELEMDESC s_mElemDesc[] = 5 | { 6 | // CommandLine 7 | {{{NULL}, VT_BSTR}, {NULL, 0x1}}, 8 | {0} 9 | }; 10 | 11 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 12 | { 13 | {L"CommandLine", {0x60020002, NULL, &s_mElemDesc[0], FUNC_DISPATCH, INVOKE_PROPERTYPUT, CC_STDCALL, 1, 0, 32, 0, {{{NULL}, VT_EMPTY}}, 0}}, 14 | {L"CommandLine", {0x60020002, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 28, 0, {{{NULL}, VT_BSTR}}, 0}} 15 | }; 16 | 17 | static HRESULT _Invoke(PVOID pvInstance, MEMBERID memid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult) 18 | { 19 | IArguments* pObject = (IArguments*)pvInstance; 20 | HRESULT hr; 21 | UINT cArgs = pDispParams->cArgs; 22 | UINT cArgs1 = cArgs - pDispParams->cNamedArgs; 23 | 24 | hr;cArgs;cArgs1; 25 | 26 | IF_INVOKE_PROPERTYPUT(0x60020002) //CommandLine 27 | { 28 | if(cArgs1 > 0) 29 | return DISP_E_BADPARAMCOUNT; 30 | 31 | INVOKE_PARAM_NAMED_VALUE(VT_BSTR, 0) 32 | 33 | hr = pObject->put_CommandLine(v0); 34 | return hr; 35 | } 36 | 37 | IF_INVOKE_PROPERTYGET(0x60020002) //CommandLine 38 | { 39 | if(cArgs1 > 0) 40 | return DISP_E_BADPARAMCOUNT; 41 | 42 | INVOKE_PARAM_RET(VT_BSTR, 0) 43 | 44 | hr = pObject->get_CommandLine(v0); 45 | return hr; 46 | } 47 | 48 | return DISP_E_MEMBERNOTFOUND; 49 | } 50 | 51 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(IArguments), L"IArguments", s_mData, 2, _Invoke); 52 | 53 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiIBaseStorage.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | 3 | static ELEMDESC s_mElemDesc[] = 4 | { 5 | // Create 6 | {{{NULL}, VT_BSTR}, {NULL, 0x1}}, 7 | {{{NULL}, VT_VARIANT}, {NULL, 0x11}}, 8 | // Open 9 | {{{NULL}, VT_BSTR}, {NULL, 0x1}}, 10 | {{{NULL}, VT_VARIANT}, {NULL, 0x11}}, 11 | // CreateFile 12 | {{{NULL}, VT_BSTR}, {NULL, 0x1}}, 13 | {{{NULL}, VT_VARIANT}, {NULL, 0x11}}, 14 | // OpenFile 15 | {{{NULL}, VT_BSTR}, {NULL, 0x1}}, 16 | {{{NULL}, VT_VARIANT}, {NULL, 0x11}}, 17 | {{{NULL}, VT_VARIANT}, {NULL, 0x11}}, 18 | // CreateFolder 19 | {{{NULL}, VT_BSTR}, {NULL, 0x1}}, 20 | {{{NULL}, VT_VARIANT}, {NULL, 0x11}}, 21 | // OpenFolder 22 | {{{NULL}, VT_BSTR}, {NULL, 0x1}}, 23 | {{{NULL}, VT_VARIANT}, {NULL, 0x11}}, 24 | {0} 25 | }; 26 | 27 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 28 | { 29 | {L"Create", {0x00000001, NULL, &s_mElemDesc[0], FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 2, 1, 28, 0, {{{NULL}, VT_EMPTY}}, 0}}, 30 | {L"Open", {0x00000002, NULL, &s_mElemDesc[2], FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 2, 1, 32, 0, {{{NULL}, VT_EMPTY}}, 0}}, 31 | {L"Close", {0x00000003, NULL, NULL, FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 0, 0, 36, 0, {{{NULL}, VT_EMPTY}}, 0}}, 32 | {L"CreateFile", {0x00000004, NULL, &s_mElemDesc[4], FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 2, 1, 40, 0, {{{NULL}, VT_DISPATCH}}, 0}}, 33 | {L"OpenFile", {0x00000005, NULL, &s_mElemDesc[6], FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 3, 2, 44, 0, {{{NULL}, VT_DISPATCH}}, 0}}, 34 | {L"CreateFolder", {0x00000006, NULL, &s_mElemDesc[9], FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 2, 1, 48, 0, {{{NULL}, VT_DISPATCH}}, 0}}, 35 | {L"OpenFolder", {0x00000007, NULL, &s_mElemDesc[11], FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 2, 1, 52, 0, {{{NULL}, VT_DISPATCH}}, 0}}, 36 | {L"_NewEnum", {0xFFFFFFFC, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 56, 0, {{{NULL}, VT_UNKNOWN}}, 1}} 37 | }; 38 | 39 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(IBaseStorage), L"IBaseStorage", s_mData, 8); 40 | 41 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiIConsole.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "ti.h" 3 | 4 | static ELEMDESC s_mElemDesc[] = 5 | { 6 | // Caption 7 | {{{NULL}, VT_BSTR}, {NULL, 0x1}}, 8 | {0} 9 | }; 10 | 11 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 12 | { 13 | {L"Caption", {0x00000065, NULL, &s_mElemDesc[0], FUNC_DISPATCH, INVOKE_PROPERTYPUT, CC_STDCALL, 1, 0, 32, 0, {{{NULL}, VT_EMPTY}}, 0}}, 14 | {L"Caption", {0x00000065, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 28, 0, {{{NULL}, VT_BSTR}}, 0}} 15 | }; 16 | 17 | static HRESULT _Invoke(PVOID pvInstance, MEMBERID memid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult) 18 | { 19 | IConsole* pObject = (IConsole*)pvInstance; 20 | HRESULT hr; 21 | UINT cArgs = pDispParams->cArgs; 22 | UINT cArgs1 = cArgs - pDispParams->cNamedArgs; 23 | 24 | hr;cArgs;cArgs1; 25 | 26 | IF_INVOKE_PROPERTYPUT(0x00000065) //Caption 27 | { 28 | if(cArgs1 > 0) 29 | return DISP_E_BADPARAMCOUNT; 30 | 31 | INVOKE_PARAM_NAMED_VALUE(VT_BSTR, 0) 32 | 33 | hr = pObject->put_Caption(v0); 34 | return hr; 35 | } 36 | 37 | IF_INVOKE_PROPERTYGET(0x00000065) //Caption 38 | { 39 | if(cArgs1 > 0) 40 | return DISP_E_BADPARAMCOUNT; 41 | 42 | INVOKE_PARAM_RET(VT_BSTR, 0) 43 | 44 | hr = pObject->get_Caption(v0); 45 | return hr; 46 | } 47 | 48 | return DISP_E_MEMBERNOTFOUND; 49 | } 50 | 51 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(IConsole), L"IConsole", s_mData, 2, _Invoke); 52 | 53 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiIErrorTrace.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "ti.h" 3 | 4 | static ELEMDESC s_mElemDesc[] = 5 | { 6 | // Write 7 | {{{NULL}, VT_BSTR}, {NULL, 0x1}}, 8 | {0} 9 | }; 10 | 11 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 12 | { 13 | {L"Name", {0x00000001, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 28, 0, {{{NULL}, VT_BSTR}}, 0}}, 14 | {L"StartTime", {0x00000002, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 32, 0, {{{NULL}, VT_DATE}}, 0}}, 15 | {L"Write", {0x00000003, NULL, &s_mElemDesc[0], FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 1, 0, 36, 0, {{{NULL}, VT_EMPTY}}, 0}}, 16 | {L"ReadAll", {0x00000004, NULL, NULL, FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 0, 0, 40, 0, {{{NULL}, VT_BSTR}}, 0}}, 17 | {L"Clear", {0x00000005, NULL, NULL, FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 0, 0, 44, 0, {{{NULL}, VT_EMPTY}}, 0}} 18 | }; 19 | 20 | static HRESULT _Invoke(PVOID pvInstance, MEMBERID memid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult) 21 | { 22 | IErrorTrace* pObject = (IErrorTrace*)pvInstance; 23 | HRESULT hr; 24 | UINT cArgs = pDispParams->cArgs; 25 | UINT cArgs1 = cArgs - pDispParams->cNamedArgs; 26 | 27 | hr;cArgs;cArgs1; 28 | 29 | IF_INVOKE_PROPERTYGET(0x00000001) //Name 30 | { 31 | if(cArgs1 > 0) 32 | return DISP_E_BADPARAMCOUNT; 33 | 34 | INVOKE_PARAM_RET(VT_BSTR, 0) 35 | 36 | hr = pObject->get_Name(v0); 37 | return hr; 38 | } 39 | 40 | IF_INVOKE_PROPERTYGET(0x00000002) //StartTime 41 | { 42 | if(cArgs1 > 0) 43 | return DISP_E_BADPARAMCOUNT; 44 | 45 | INVOKE_PARAM_RET(VT_DATE, 0) 46 | 47 | hr = pObject->get_StartTime(v0); 48 | return hr; 49 | } 50 | 51 | IF_INVOKE_FUNC(0x00000003) //Write 52 | { 53 | if(cArgs1 > 1) 54 | return DISP_E_BADPARAMCOUNT; 55 | 56 | if(cArgs1 < 1) 57 | return DISP_E_PARAMNOTOPTIONAL; 58 | 59 | INVOKE_PARAM(VT_BSTR, 0) 60 | 61 | hr = pObject->Write(v0); 62 | return hr; 63 | } 64 | 65 | IF_INVOKE_FUNC(0x00000004) //ReadAll 66 | { 67 | if(cArgs1 > 0) 68 | return DISP_E_BADPARAMCOUNT; 69 | 70 | INVOKE_PARAM_RET(VT_BSTR, 0) 71 | 72 | hr = pObject->ReadAll(v0); 73 | return hr; 74 | } 75 | 76 | IF_INVOKE_FUNC(0x00000005) //Clear 77 | { 78 | if(cArgs1 > 0) 79 | return DISP_E_BADPARAMCOUNT; 80 | 81 | hr = pObject->Clear(); 82 | return hr; 83 | } 84 | 85 | return DISP_E_MEMBERNOTFOUND; 86 | } 87 | 88 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(IErrorTrace), L"IErrorTrace", s_mData, 5, _Invoke); 89 | 90 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiIFileStream.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "ti.h" 3 | 4 | static PARAMDESCEX s_mElemDescEx[] = 5 | { 6 | {0x18, {VT_BOOL, 0, 0, 0, -1}}, 7 | {0x18, {VT_I2, 0, 0, 0, 1}}, 8 | {0x18, {VT_I2, 0, 0, 0, 3}}, 9 | {0} 10 | }; 11 | 12 | static ELEMDESC s_mElemDesc[] = 13 | { 14 | // Create 15 | {{{NULL}, VT_BSTR}, {NULL, 0x1}}, 16 | {{{NULL}, VT_BOOL}, {(ULONG_PTR)&s_mElemDescEx[0], 0x31}}, 17 | // Open 18 | {{{NULL}, VT_BSTR}, {NULL, 0x1}}, 19 | {{{NULL}, VT_I2}, {(ULONG_PTR)&s_mElemDescEx[1], 0x31}}, 20 | {{{NULL}, VT_I2}, {(ULONG_PTR)&s_mElemDescEx[2], 0x31}}, 21 | {0} 22 | }; 23 | 24 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 25 | { 26 | {L"Create", {0x00000065, NULL, &s_mElemDesc[0], FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 2, 0, 28, 0, {{{NULL}, VT_EMPTY}}, 0}}, 27 | {L"Open", {0x00000066, NULL, &s_mElemDesc[2], FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 3, 0, 32, 0, {{{NULL}, VT_EMPTY}}, 0}}, 28 | }; 29 | 30 | static HRESULT _Invoke(PVOID pvInstance, MEMBERID memid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult) 31 | { 32 | IFileStream* pObject = (IFileStream*)pvInstance; 33 | HRESULT hr; 34 | UINT cArgs = pDispParams->cArgs; 35 | UINT cArgs1 = cArgs - pDispParams->cNamedArgs; 36 | 37 | hr;cArgs;cArgs1; 38 | 39 | IF_INVOKE_FUNC(0x00000065) //Create 40 | { 41 | if(cArgs1 > 2) 42 | return DISP_E_BADPARAMCOUNT; 43 | 44 | if(cArgs1 < 1) 45 | return DISP_E_PARAMNOTOPTIONAL; 46 | 47 | INVOKE_PARAM(VT_BSTR, 0) 48 | INVOKE_PARAM_DEF(VT_BOOL, 1, 0) 49 | 50 | hr = pObject->Create(v0, v1); 51 | return hr; 52 | } 53 | 54 | IF_INVOKE_FUNC(0x00000066) //Open 55 | { 56 | if(cArgs1 > 3) 57 | return DISP_E_BADPARAMCOUNT; 58 | 59 | if(cArgs1 < 1) 60 | return DISP_E_PARAMNOTOPTIONAL; 61 | 62 | INVOKE_PARAM(VT_BSTR, 0) 63 | INVOKE_PARAM_DEF(VT_I2, 1, 1) 64 | INVOKE_PARAM_DEF(VT_I2, 2, 2) 65 | 66 | hr = pObject->Open(v0, v1, v2); 67 | return hr; 68 | } 69 | 70 | return DISP_E_MEMBERNOTFOUND; 71 | } 72 | 73 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(IFileStream), L"IFileStream", s_mData, 2, _Invoke); 74 | 75 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiIFolder.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "ti.h" 3 | 4 | static ELEMDESC s_mElemDesc[] = 5 | { 6 | {0} 7 | }; 8 | 9 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 10 | { 11 | {L"Files", {0x00000010, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 28, 0, {{{NULL}, VT_DISPATCH}}, 0}}, 12 | {L"SubFolders", {0x00000011, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 32, 0, {{{NULL}, VT_DISPATCH}}, 0}}, 13 | {L"IsModified", {0x00000012, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 36, 0, {{{NULL}, VT_BOOL}}, 0}} 14 | }; 15 | 16 | static HRESULT _Invoke(PVOID pvInstance, MEMBERID memid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult) 17 | { 18 | IFolder* pObject = (IFolder*)pvInstance; 19 | HRESULT hr; 20 | UINT cArgs = pDispParams->cArgs; 21 | UINT cArgs1 = cArgs - pDispParams->cNamedArgs; 22 | 23 | hr;cArgs;cArgs1; 24 | 25 | IF_INVOKE(0x00000010) //Files 26 | { 27 | INVOKE_PARAM_RET(VT_DISPATCH, 0) 28 | 29 | hr = pObject->get_Files(v0); 30 | 31 | INVOKE_DISP; 32 | return hr; 33 | } 34 | 35 | IF_INVOKE(0x00000011) //SubFolders 36 | { 37 | INVOKE_PARAM_RET(VT_DISPATCH, 0) 38 | 39 | hr = pObject->get_SubFolders(v0); 40 | 41 | INVOKE_DISP; 42 | return hr; 43 | } 44 | 45 | IF_INVOKE_PROPERTYGET(0x00000012) //IsModified 46 | { 47 | if(cArgs1 > 0) 48 | return DISP_E_BADPARAMCOUNT; 49 | 50 | INVOKE_PARAM_RET(VT_BOOL, 0) 51 | 52 | hr = pObject->get_IsModified(v0); 53 | return hr; 54 | } 55 | 56 | return DISP_E_MEMBERNOTFOUND; 57 | } 58 | 59 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(IFolder), L"IFolder", s_mData, 3, _Invoke); 60 | 61 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiIMatch.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "ti.h" 3 | 4 | static ELEMDESC s_mElemDesc[] = 5 | { 6 | {0} 7 | }; 8 | 9 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 10 | { 11 | {L"SubMatches", {0x00000010, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 28, 0, {{{NULL}, VT_DISPATCH}}, 0}} 12 | }; 13 | 14 | static HRESULT _Invoke(PVOID pvInstance, MEMBERID memid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult) 15 | { 16 | IMatch* pObject = (IMatch*)pvInstance; 17 | HRESULT hr; 18 | UINT cArgs = pDispParams->cArgs; 19 | UINT cArgs1 = cArgs - pDispParams->cNamedArgs; 20 | 21 | hr;cArgs;cArgs1; 22 | 23 | IF_INVOKE(0x00000010) //SubMatches 24 | { 25 | INVOKE_PARAM_RET(VT_DISPATCH, 0) 26 | 27 | hr = pObject->get_SubMatches(v0); 28 | 29 | INVOKE_DISP; 30 | return hr; 31 | } 32 | 33 | return DISP_E_MEMBERNOTFOUND; 34 | } 35 | 36 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(IMatch), L"IMatch", s_mData, 1, _Invoke); 37 | 38 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiIPackage.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "ti.h" 3 | 4 | static ELEMDESC s_mElemDesc[] = 5 | { 6 | {0} 7 | }; 8 | 9 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 10 | { 11 | {L"FileName", {0x00000000, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 28, 0, {{{NULL}, VT_BSTR}}, 0}}, 12 | {L"CheckSum", {0x00000001, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 32, 0, {{{NULL}, VT_BSTR}}, 0}}, 13 | {L"Files", {0x00000002, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 36, 0, {{{NULL}, VT_DISPATCH}}, 0}}, 14 | {L"Folders", {0x00000003, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 40, 0, {{{NULL}, VT_DISPATCH}}, 0}}, 15 | {L"DeveloperID", {0x00000004, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 44, 0, {{{NULL}, VT_I4}}, 0}} 16 | }; 17 | 18 | static HRESULT _Invoke(PVOID pvInstance, MEMBERID memid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult) 19 | { 20 | IPackage* pObject = (IPackage*)pvInstance; 21 | HRESULT hr; 22 | UINT cArgs = pDispParams->cArgs; 23 | UINT cArgs1 = cArgs - pDispParams->cNamedArgs; 24 | 25 | hr;cArgs;cArgs1; 26 | 27 | IF_INVOKE_PROPERTYGET(0x00000000) //FileName 28 | { 29 | if(cArgs1 > 0) 30 | return DISP_E_BADPARAMCOUNT; 31 | 32 | INVOKE_PARAM_RET(VT_BSTR, 0) 33 | 34 | hr = pObject->get_FileName(v0); 35 | return hr; 36 | } 37 | 38 | IF_INVOKE_PROPERTYGET(0x00000001) //CheckSum 39 | { 40 | if(cArgs1 > 0) 41 | return DISP_E_BADPARAMCOUNT; 42 | 43 | INVOKE_PARAM_RET(VT_BSTR, 0) 44 | 45 | hr = pObject->get_CheckSum(v0); 46 | return hr; 47 | } 48 | 49 | IF_INVOKE(0x00000002) //Files 50 | { 51 | INVOKE_PARAM_RET(VT_DISPATCH, 0) 52 | 53 | hr = pObject->get_Files(v0); 54 | 55 | INVOKE_DISP; 56 | return hr; 57 | } 58 | 59 | IF_INVOKE(0x00000003) //Folders 60 | { 61 | INVOKE_PARAM_RET(VT_DISPATCH, 0) 62 | 63 | hr = pObject->get_Folders(v0); 64 | 65 | INVOKE_DISP; 66 | return hr; 67 | } 68 | 69 | IF_INVOKE_PROPERTYGET(0x00000004) //DeveloperID 70 | { 71 | if(cArgs1 > 0) 72 | return DISP_E_BADPARAMCOUNT; 73 | 74 | INVOKE_PARAM_RET(VT_I4, 0) 75 | 76 | hr = pObject->get_DeveloperID(v0); 77 | return hr; 78 | } 79 | 80 | return DISP_E_MEMBERNOTFOUND; 81 | } 82 | 83 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(IPackage), L"IPackage", s_mData, 5, _Invoke); 84 | 85 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiIPipe.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "ti.h" 3 | 4 | static PARAMDESCEX s_mElemDescEx[] = 5 | { 6 | {0x18, {VT_I4, 0, 0, 0, 0}}, 7 | {0} 8 | }; 9 | 10 | static ELEMDESC s_mElemDesc[] = 11 | { 12 | // Open 13 | {{{NULL}, VT_I4}, {(ULONG_PTR)&s_mElemDescEx[0], 0x31}}, 14 | {0} 15 | }; 16 | 17 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 18 | { 19 | {L"dataAvailable", {0x00000066, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 32, 0, {{{NULL}, VT_I4}}, 0}}, 20 | {L"Open", {0x00000065, NULL, &s_mElemDesc[0], FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 1, 0, 28, 0, {{{NULL}, VT_DISPATCH}}, 0}} 21 | }; 22 | 23 | static HRESULT _Invoke(PVOID pvInstance, MEMBERID memid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult) 24 | { 25 | IPipe* pObject = (IPipe*)pvInstance; 26 | HRESULT hr; 27 | UINT cArgs = pDispParams->cArgs; 28 | UINT cArgs1 = cArgs - pDispParams->cNamedArgs; 29 | 30 | hr;cArgs;cArgs1; 31 | 32 | IF_INVOKE_PROPERTYGET(0x00000066) //dataAvailable 33 | { 34 | if(cArgs1 > 0) 35 | return DISP_E_BADPARAMCOUNT; 36 | 37 | INVOKE_PARAM_RET(VT_I4, 0) 38 | 39 | hr = pObject->get_dataAvailable(v0); 40 | return hr; 41 | } 42 | 43 | IF_INVOKE_FUNC(0x00000065) //Open 44 | { 45 | if(cArgs1 > 1) 46 | return DISP_E_BADPARAMCOUNT; 47 | 48 | INVOKE_PARAM_DEF(VT_I4, 0, 0) 49 | INVOKE_PARAM_RET(VT_DISPATCH, 1) 50 | 51 | hr = pObject->Open(v0, v1); 52 | return hr; 53 | } 54 | 55 | return DISP_E_MEMBERNOTFOUND; 56 | } 57 | 58 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(IPipe), L"IPipe", s_mData, 2, _Invoke); 59 | 60 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiIPipeLine.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "ti.h" 3 | 4 | static PARAMDESCEX s_mElemDescEx[] = 5 | { 6 | {0x18, {VT_I4, 0, 0, 0, 1048576}}, 7 | {0} 8 | }; 9 | 10 | static ELEMDESC s_mElemDesc[] = 11 | { 12 | // Open 13 | {{{NULL}, VT_I4}, {(ULONG_PTR)&s_mElemDescEx[0], 0x31}}, 14 | {0} 15 | }; 16 | 17 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 18 | { 19 | {L"dataAvailable", {0x00000066, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 32, 0, {{{NULL}, VT_I4}}, 0}}, 20 | {L"Open", {0x00000065, NULL, &s_mElemDesc[0], FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 1, 0, 28, 0, {{{NULL}, VT_DISPATCH}}, 0}} 21 | }; 22 | 23 | static HRESULT _Invoke(PVOID pvInstance, MEMBERID memid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult) 24 | { 25 | IPipeLine* pObject = (IPipeLine*)pvInstance; 26 | HRESULT hr; 27 | UINT cArgs = pDispParams->cArgs; 28 | UINT cArgs1 = cArgs - pDispParams->cNamedArgs; 29 | 30 | hr;cArgs;cArgs1; 31 | 32 | IF_INVOKE_PROPERTYGET(0x00000066) //dataAvailable 33 | { 34 | if(cArgs1 > 0) 35 | return DISP_E_BADPARAMCOUNT; 36 | 37 | INVOKE_PARAM_RET(VT_I4, 0) 38 | 39 | hr = pObject->get_dataAvailable(v0); 40 | return hr; 41 | } 42 | 43 | IF_INVOKE_FUNC(0x00000065) //Open 44 | { 45 | if(cArgs1 > 1) 46 | return DISP_E_BADPARAMCOUNT; 47 | 48 | INVOKE_PARAM_DEF(VT_I4, 0, 0) 49 | INVOKE_PARAM_RET(VT_DISPATCH, 1) 50 | 51 | hr = pObject->Open(v0, v1); 52 | return hr; 53 | } 54 | 55 | return DISP_E_MEMBERNOTFOUND; 56 | } 57 | 58 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(IPipeLine), L"IPipeLine", s_mData, 2, _Invoke); 59 | 60 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiIRSField.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "ti.h" 3 | 4 | static ELEMDESC s_mElemDesc[] = 5 | { 6 | {0} 7 | }; 8 | 9 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 10 | { 11 | {L"Name", {0x00000001, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 28, 0, {{{NULL}, VT_BSTR}}, 0}}, 12 | {L"Type", {0x00000002, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 32, 0, {{{NULL}, VT_I4}}, 0}} 13 | }; 14 | 15 | static HRESULT _Invoke(PVOID pvInstance, MEMBERID memid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) 16 | { 17 | IRSField* pObject = (IRSField*)pvInstance; 18 | HRESULT hr; 19 | UINT cArgs = pDispParams->cArgs; 20 | UINT cArgs1 = cArgs - pDispParams->cNamedArgs; 21 | 22 | hr;cArgs;cArgs1; 23 | 24 | IF_INVOKE_PROPERTYGET(0x00000001) //Name 25 | { 26 | if(cArgs1 > 0) 27 | return DISP_E_BADPARAMCOUNT; 28 | 29 | INVOKE_PARAM_RET(VT_BSTR, 0) 30 | 31 | hr = pObject->get_Name(v0); 32 | return hr; 33 | } 34 | 35 | IF_INVOKE_PROPERTYGET(0x00000002) //Type 36 | { 37 | if(cArgs1 > 0) 38 | return DISP_E_BADPARAMCOUNT; 39 | 40 | INVOKE_PARAM_RET(VT_I4, 0) 41 | 42 | hr = pObject->get_Type(v0); 43 | return hr; 44 | } 45 | 46 | return DISP_E_MEMBERNOTFOUND; 47 | } 48 | 49 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(IRSField), L"IRSField", s_mData, 2, _Invoke); 50 | 51 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiIRandom.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "ti.h" 3 | 4 | static PARAMDESCEX s_mElemDescEx[] = 5 | { 6 | {0x18, {VT_I2, 0, 0, 0, 16}}, 7 | {0} 8 | }; 9 | 10 | static ELEMDESC s_mElemDesc[] = 11 | { 12 | // Generate 13 | {{{NULL}, VT_I2}, {(ULONG_PTR)&s_mElemDescEx[0], 0x31}}, 14 | {0} 15 | }; 16 | 17 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 18 | { 19 | {L"Generate", {0x00000000, NULL, &s_mElemDesc[0], FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 1, 0, 28, 0, {{{NULL}, VT_VARIANT}}, 0}} 20 | }; 21 | 22 | static HRESULT _Invoke(PVOID pvInstance, MEMBERID memid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult) 23 | { 24 | IRandom* pObject = (IRandom*)pvInstance; 25 | HRESULT hr; 26 | UINT cArgs = pDispParams->cArgs; 27 | UINT cArgs1 = cArgs - pDispParams->cNamedArgs; 28 | 29 | hr;cArgs;cArgs1; 30 | 31 | IF_INVOKE_FUNC(0x00000000) //Generate 32 | { 33 | if(cArgs1 > 1) 34 | return DISP_E_BADPARAMCOUNT; 35 | 36 | INVOKE_PARAM_DEF(VT_I2, 0, 0) 37 | INVOKE_PARAM_RET(VT_VARIANT, 1) 38 | 39 | hr = pObject->Generate(v0, v1); 40 | return hr; 41 | } 42 | 43 | return DISP_E_MEMBERNOTFOUND; 44 | } 45 | 46 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(IRandom), L"IRandom", s_mData, 1, _Invoke); 47 | 48 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiIStorageItem.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | 3 | static ELEMDESC s_mElemDesc[] = 4 | { 5 | {0} 6 | }; 7 | 8 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 9 | { 10 | {L"Name", {0x00000001, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 28, 0, {{{NULL}, VT_BSTR}}, 0}}, 11 | {L"Type", {0x00000002, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 32, 0, {{{NULL}, VT_I2}}, 0}}, 12 | {L"Size", {0x00000003, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 36, 0, {{{NULL}, VT_I4}}, 0}}, 13 | {L"DateCreated", {0x00000004, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 40, 0, {{{NULL}, VT_DATE}}, 0}}, 14 | {L"DateLastAccessed", {0x00000005, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 44, 0, {{{NULL}, VT_DATE}}, 0}}, 15 | {L"DateLastModified", {0x00000006, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 48, 0, {{{NULL}, VT_DATE}}, 0}} 16 | }; 17 | 18 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(IStorageItem), L"IStorageItem", s_mData, 6); 19 | 20 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiIStringList.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "ti.h" 3 | 4 | static ELEMDESC s_mElemDesc[] = 5 | { 6 | // Item 7 | {{{NULL}, VT_VARIANT}, {NULL, 0x11}}, 8 | {0} 9 | }; 10 | 11 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 12 | { 13 | {L"Item", {0x00000000, NULL, &s_mElemDesc[0], FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 1, 1, 28, 0, {{{NULL}, VT_VARIANT}}, 0}}, 14 | {L"Count", {0x60020001, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 32, 0, {{{NULL}, VT_I4}}, 0}}, 15 | {L"_NewEnum", {0xFFFFFFFC, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 36, 0, {{{NULL}, VT_UNKNOWN}}, 1}}, 16 | {L"Items", {0x60020002, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 40, 0, {{{NULL}, VT_VARIANT}}, 0}} 17 | }; 18 | 19 | static HRESULT _Invoke(PVOID pvInstance, MEMBERID memid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult) 20 | { 21 | IStringList* pObject = (IStringList*)pvInstance; 22 | HRESULT hr; 23 | UINT cArgs = pDispParams->cArgs; 24 | UINT cArgs1 = cArgs - pDispParams->cNamedArgs; 25 | 26 | hr;cArgs;cArgs1; 27 | 28 | IF_INVOKE(0x00000000) //Item 29 | { 30 | if(cArgs1 > 1) 31 | return DISP_E_BADPARAMCOUNT; 32 | 33 | INVOKE_PARAM_OPT(VT_VARIANT, 0) 34 | INVOKE_PARAM_RET(VT_VARIANT, 1) 35 | 36 | hr = pObject->get_Item(v0, v1); 37 | 38 | INVOKE_DISP_PUT(1); 39 | return hr; 40 | } 41 | 42 | IF_INVOKE_PROPERTYGET(0x60020001) //Count 43 | { 44 | if(cArgs1 > 0) 45 | return DISP_E_BADPARAMCOUNT; 46 | 47 | INVOKE_PARAM_RET(VT_I4, 0) 48 | 49 | hr = pObject->get_Count(v0); 50 | return hr; 51 | } 52 | 53 | IF_INVOKE_PROPERTYGET(0xFFFFFFFC) //_NewEnum 54 | { 55 | if(cArgs1 > 0) 56 | return DISP_E_BADPARAMCOUNT; 57 | 58 | INVOKE_PARAM_RET(VT_UNKNOWN, 0) 59 | 60 | hr = pObject->get__NewEnum(v0); 61 | return hr; 62 | } 63 | 64 | IF_INVOKE(0x60020002) //Items 65 | { 66 | INVOKE_PARAM_RET(VT_VARIANT, 0) 67 | 68 | hr = pObject->get_Items(v0); 69 | 70 | INVOKE_DISP; 71 | return hr; 72 | } 73 | 74 | return DISP_E_MEMBERNOTFOUND; 75 | } 76 | 77 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(IStringList), L"IStringList", s_mData, 4, _Invoke); 78 | 79 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiISubMatch.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "ti.h" 3 | 4 | static ELEMDESC s_mElemDesc[] = 5 | { 6 | {0} 7 | }; 8 | 9 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 10 | { 11 | {L"Value", {0x00000000, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 28, 0, {{{NULL}, VT_BSTR}}, 0}}, 12 | {L"FirstIndex", {0x00000001, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 32, 0, {{{NULL}, VT_I4}}, 0}}, 13 | {L"Length", {0x00000002, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 36, 0, {{{NULL}, VT_I4}}, 0}} 14 | }; 15 | 16 | static HRESULT _Invoke(PVOID pvInstance, MEMBERID memid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult) 17 | { 18 | ISubMatch* pObject = (ISubMatch*)pvInstance; 19 | HRESULT hr; 20 | UINT cArgs = pDispParams->cArgs; 21 | UINT cArgs1 = cArgs - pDispParams->cNamedArgs; 22 | 23 | hr;cArgs;cArgs1; 24 | 25 | IF_INVOKE_PROPERTYGET(0x00000000) //Value 26 | { 27 | if(cArgs1 > 0) 28 | return DISP_E_BADPARAMCOUNT; 29 | 30 | INVOKE_PARAM_RET(VT_BSTR, 0) 31 | 32 | hr = pObject->get_Value(v0); 33 | return hr; 34 | } 35 | 36 | IF_INVOKE_PROPERTYGET(0x00000001) //FirstIndex 37 | { 38 | if(cArgs1 > 0) 39 | return DISP_E_BADPARAMCOUNT; 40 | 41 | INVOKE_PARAM_RET(VT_I4, 0) 42 | 43 | hr = pObject->get_FirstIndex(v0); 44 | return hr; 45 | } 46 | 47 | IF_INVOKE_PROPERTYGET(0x00000002) //Length 48 | { 49 | if(cArgs1 > 0) 50 | return DISP_E_BADPARAMCOUNT; 51 | 52 | INVOKE_PARAM_RET(VT_I4, 0) 53 | 54 | hr = pObject->get_Length(v0); 55 | return hr; 56 | } 57 | 58 | return DISP_E_MEMBERNOTFOUND; 59 | } 60 | 61 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(ISubMatch), L"ISubMatch", s_mData, 3, _Invoke); 62 | 63 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiIUDPPacket.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "ti.h" 3 | 4 | static ELEMDESC s_mElemDesc[] = 5 | { 6 | {0} 7 | }; 8 | 9 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 10 | { 11 | {L"Data", {0x00000000, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 28, 0, {{{NULL}, VT_VARIANT}}, 0}}, 12 | {L"LocalAddress", {0x00000001, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 32, 0, {{{NULL}, VT_BSTR}}, 0}}, 13 | {L"LocalPort", {0x00000002, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 36, 0, {{{NULL}, VT_I4}}, 0}}, 14 | {L"RemoteAddress", {0x00000003, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 40, 0, {{{NULL}, VT_BSTR}}, 0}}, 15 | {L"RemotePort", {0x00000004, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 44, 0, {{{NULL}, VT_I4}}, 0}} 16 | }; 17 | 18 | static HRESULT _Invoke(PVOID pvInstance, MEMBERID memid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult) 19 | { 20 | IUDPPacket* pObject = (IUDPPacket*)pvInstance; 21 | HRESULT hr; 22 | UINT cArgs = pDispParams->cArgs; 23 | UINT cArgs1 = cArgs - pDispParams->cNamedArgs; 24 | 25 | hr;cArgs;cArgs1; 26 | 27 | IF_INVOKE(0x00000000) //Data 28 | { 29 | INVOKE_PARAM_RET(VT_VARIANT, 0) 30 | 31 | hr = pObject->get_Data(v0); 32 | 33 | INVOKE_DISP; 34 | return hr; 35 | } 36 | 37 | IF_INVOKE_PROPERTYGET(0x00000001) //LocalAddress 38 | { 39 | if(cArgs1 > 0) 40 | return DISP_E_BADPARAMCOUNT; 41 | 42 | INVOKE_PARAM_RET(VT_BSTR, 0) 43 | 44 | hr = pObject->get_LocalAddress(v0); 45 | return hr; 46 | } 47 | 48 | IF_INVOKE_PROPERTYGET(0x00000002) //LocalPort 49 | { 50 | if(cArgs1 > 0) 51 | return DISP_E_BADPARAMCOUNT; 52 | 53 | INVOKE_PARAM_RET(VT_I4, 0) 54 | 55 | hr = pObject->get_LocalPort(v0); 56 | return hr; 57 | } 58 | 59 | IF_INVOKE_PROPERTYGET(0x00000003) //RemoteAddress 60 | { 61 | if(cArgs1 > 0) 62 | return DISP_E_BADPARAMCOUNT; 63 | 64 | INVOKE_PARAM_RET(VT_BSTR, 0) 65 | 66 | hr = pObject->get_RemoteAddress(v0); 67 | return hr; 68 | } 69 | 70 | IF_INVOKE_PROPERTYGET(0x00000004) //RemotePort 71 | { 72 | if(cArgs1 > 0) 73 | return DISP_E_BADPARAMCOUNT; 74 | 75 | INVOKE_PARAM_RET(VT_I4, 0) 76 | 77 | hr = pObject->get_RemotePort(v0); 78 | return hr; 79 | } 80 | 81 | return DISP_E_MEMBERNOTFOUND; 82 | } 83 | 84 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(IUDPPacket), L"IUDPPacket", s_mData, 5, _Invoke); 85 | 86 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiIUploadData.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "ti.h" 3 | 4 | static ELEMDESC s_mElemDesc[] = 5 | { 6 | {0} 7 | }; 8 | 9 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 10 | { 11 | {L"Item", {0x00000000, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 28, 0, {{{NULL}, VT_VARIANT}}, 0}}, 12 | {L"FileName", {0x00000001, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 32, 0, {{{NULL}, VT_BSTR}}, 0}}, 13 | {L"Size", {0x00000002, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 36, 0, {{{NULL}, VT_I4}}, 0}}, 14 | {L"ContentType", {0x00000003, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 40, 0, {{{NULL}, VT_BSTR}}, 0}} 15 | }; 16 | 17 | static HRESULT _Invoke(PVOID pvInstance, MEMBERID memid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult) 18 | { 19 | IUploadData* pObject = (IUploadData*)pvInstance; 20 | HRESULT hr; 21 | UINT cArgs = pDispParams->cArgs; 22 | UINT cArgs1 = cArgs - pDispParams->cNamedArgs; 23 | 24 | hr;cArgs;cArgs1; 25 | 26 | IF_INVOKE(0x00000000) //Item 27 | { 28 | INVOKE_PARAM_RET(VT_VARIANT, 0) 29 | 30 | hr = pObject->get_Item(v0); 31 | 32 | INVOKE_DISP; 33 | return hr; 34 | } 35 | 36 | IF_INVOKE_PROPERTYGET(0x00000001) //FileName 37 | { 38 | if(cArgs1 > 0) 39 | return DISP_E_BADPARAMCOUNT; 40 | 41 | INVOKE_PARAM_RET(VT_BSTR, 0) 42 | 43 | hr = pObject->get_FileName(v0); 44 | return hr; 45 | } 46 | 47 | IF_INVOKE_PROPERTYGET(0x00000002) //Size 48 | { 49 | if(cArgs1 > 0) 50 | return DISP_E_BADPARAMCOUNT; 51 | 52 | INVOKE_PARAM_RET(VT_I4, 0) 53 | 54 | hr = pObject->get_Size(v0); 55 | return hr; 56 | } 57 | 58 | IF_INVOKE_PROPERTYGET(0x00000003) //ContentType 59 | { 60 | if(cArgs1 > 0) 61 | return DISP_E_BADPARAMCOUNT; 62 | 63 | INVOKE_PARAM_RET(VT_BSTR, 0) 64 | 65 | hr = pObject->get_ContentType(v0); 66 | return hr; 67 | } 68 | 69 | return DISP_E_MEMBERNOTFOUND; 70 | } 71 | 72 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(IUploadData), L"IUploadData", s_mData, 4, _Invoke); 73 | 74 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiIUploadList.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "ti.h" 3 | 4 | static ELEMDESC s_mElemDesc[] = 5 | { 6 | {0} 7 | }; 8 | 9 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 10 | { 11 | {L"FileName", {0x60020003, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 28, 0, {{{NULL}, VT_BSTR}}, 0}}, 12 | {L"Size", {0x60020004, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 32, 0, {{{NULL}, VT_I4}}, 0}}, 13 | {L"ContentType", {0x60020005, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 36, 0, {{{NULL}, VT_BSTR}}, 0}} 14 | }; 15 | 16 | static HRESULT _Invoke(PVOID pvInstance, MEMBERID memid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult) 17 | { 18 | IUploadList* pObject = (IUploadList*)pvInstance; 19 | HRESULT hr; 20 | UINT cArgs = pDispParams->cArgs; 21 | UINT cArgs1 = cArgs - pDispParams->cNamedArgs; 22 | 23 | hr;cArgs;cArgs1; 24 | 25 | IF_INVOKE_PROPERTYGET(0x60020003) //FileName 26 | { 27 | if(cArgs1 > 0) 28 | return DISP_E_BADPARAMCOUNT; 29 | 30 | INVOKE_PARAM_RET(VT_BSTR, 0) 31 | 32 | hr = pObject->get_FileName(v0); 33 | return hr; 34 | } 35 | 36 | IF_INVOKE_PROPERTYGET(0x60020004) //Size 37 | { 38 | if(cArgs1 > 0) 39 | return DISP_E_BADPARAMCOUNT; 40 | 41 | INVOKE_PARAM_RET(VT_I4, 0) 42 | 43 | hr = pObject->get_Size(v0); 44 | return hr; 45 | } 46 | 47 | IF_INVOKE_PROPERTYGET(0x60020005) //ContentType 48 | { 49 | if(cArgs1 > 0) 50 | return DISP_E_BADPARAMCOUNT; 51 | 52 | INVOKE_PARAM_RET(VT_BSTR, 0) 53 | 54 | hr = pObject->get_ContentType(v0); 55 | return hr; 56 | } 57 | 58 | return DISP_E_MEMBERNOTFOUND; 59 | } 60 | 61 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(IUploadList), L"IUploadList", s_mData, 3, _Invoke); 62 | 63 | -------------------------------------------------------------------------------- /BoxLib/typelib/tiIVariantDirectory.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | 3 | static ELEMDESC s_mElemDesc[] = 4 | { 5 | // AutoCreateDirectory 6 | {{{NULL}, VT_BOOL}}, 7 | // CreateDirectory 8 | {{{NULL}, VT_BSTR}}, 9 | // CopyTo 10 | {{{NULL}, VT_BSTR}}, 11 | {{{NULL}, VT_BSTR}}, 12 | // MoveTo 13 | {{{NULL}, VT_BSTR}}, 14 | {{{NULL}, VT_BSTR}}, 15 | // Link 16 | {{{NULL}, VT_BSTR}}, 17 | {{{NULL}, VT_BSTR}}, 18 | {0} 19 | }; 20 | 21 | static CBTypeInfo::METHOD_ENTRY s_mData[] = 22 | { 23 | {L"AutoCreateDirectory", {0x00000064, NULL, NULL, FUNC_DISPATCH, INVOKE_PROPERTYGET, CC_STDCALL, 0, 0, 0, 0, {{{NULL}, VT_BOOL}}}, VT_BYREF | VT_BOOL}, 24 | {L"AutoCreateDirectory", {0x00000064, NULL, &s_mElemDesc[0], FUNC_DISPATCH, INVOKE_PROPERTYPUT, CC_STDCALL, 1, 0, 0, 0, {{{NULL}, VT_EMPTY}}}, VT_BOOL}, 25 | {L"CreateDirectory", {0x00000065, NULL, &s_mElemDesc[1], FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 1, 0, 0, 0, {{{NULL}, VT_EMPTY}}}, VT_BSTR}, 26 | {L"CopyTo", {0x00000066, NULL, &s_mElemDesc[2], FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 2, 0, 0, 0, {{{NULL}, VT_EMPTY}}}, VT_BSTR, VT_BSTR}, 27 | {L"MoveTo", {0x00000067, NULL, &s_mElemDesc[4], FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 2, 0, 0, 0, {{{NULL}, VT_EMPTY}}}, VT_BSTR, VT_BSTR}, 28 | {L"Link", {0x00000068, NULL, &s_mElemDesc[6], FUNC_DISPATCH, INVOKE_FUNC, CC_STDCALL, 2, 0, 0, 0, {{{NULL}, VT_EMPTY}}}, VT_BSTR, VT_BSTR} 29 | }; 30 | 31 | CBTypeInfo CBDispatch::g_typeinfo(__uuidof(IVariantDirectory), L"IVariantDirectory", s_mData, 6); 32 | 33 | -------------------------------------------------------------------------------- /BoxLib/zlib/adler32.c: -------------------------------------------------------------------------------- 1 | /* adler32.c -- compute the Adler-32 checksum of a data stream 2 | * Copyright (C) 1995-2003 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | #define BASE 65521UL /* largest prime smaller than 65536 */ 12 | #define NMAX 5552 13 | /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ 14 | 15 | #define DO1(buf,i) {s1 += buf[i]; s2 += s1;} 16 | #define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); 17 | #define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); 18 | #define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); 19 | #define DO16(buf) DO8(buf,0); DO8(buf,8); 20 | 21 | #ifdef NO_DIVIDE 22 | # define MOD(a) \ 23 | do { \ 24 | if (a >= (BASE << 16)) a -= (BASE << 16); \ 25 | if (a >= (BASE << 15)) a -= (BASE << 15); \ 26 | if (a >= (BASE << 14)) a -= (BASE << 14); \ 27 | if (a >= (BASE << 13)) a -= (BASE << 13); \ 28 | if (a >= (BASE << 12)) a -= (BASE << 12); \ 29 | if (a >= (BASE << 11)) a -= (BASE << 11); \ 30 | if (a >= (BASE << 10)) a -= (BASE << 10); \ 31 | if (a >= (BASE << 9)) a -= (BASE << 9); \ 32 | if (a >= (BASE << 8)) a -= (BASE << 8); \ 33 | if (a >= (BASE << 7)) a -= (BASE << 7); \ 34 | if (a >= (BASE << 6)) a -= (BASE << 6); \ 35 | if (a >= (BASE << 5)) a -= (BASE << 5); \ 36 | if (a >= (BASE << 4)) a -= (BASE << 4); \ 37 | if (a >= (BASE << 3)) a -= (BASE << 3); \ 38 | if (a >= (BASE << 2)) a -= (BASE << 2); \ 39 | if (a >= (BASE << 1)) a -= (BASE << 1); \ 40 | if (a >= BASE) a -= BASE; \ 41 | } while (0) 42 | #else 43 | # define MOD(a) a %= BASE 44 | #endif 45 | 46 | /* ========================================================================= */ 47 | uLong ZEXPORT adler32(adler, buf, len) 48 | uLong adler; 49 | const Bytef *buf; 50 | uInt len; 51 | { 52 | unsigned long s1 = adler & 0xffff; 53 | unsigned long s2 = (adler >> 16) & 0xffff; 54 | int k; 55 | 56 | if (buf == Z_NULL) return 1L; 57 | 58 | while (len > 0) { 59 | k = len < NMAX ? (int)len : NMAX; 60 | len -= k; 61 | while (k >= 16) { 62 | DO16(buf); 63 | buf += 16; 64 | k -= 16; 65 | } 66 | if (k != 0) do { 67 | s1 += *buf++; 68 | s2 += s1; 69 | } while (--k); 70 | MOD(s1); 71 | MOD(s2); 72 | } 73 | return (s2 << 16) | s1; 74 | } 75 | -------------------------------------------------------------------------------- /BoxLib/zlib/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /BoxLib/zlib/inftrees.h: -------------------------------------------------------------------------------- 1 | /* inftrees.h -- header to use inftrees.c 2 | * Copyright (C) 1995-2003 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | /* Structure for decoding tables. Each entry provides either the 12 | information needed to do the operation requested by the code that 13 | indexed that table entry, or it provides a pointer to another 14 | table that indexes more bits of the code. op indicates whether 15 | the entry is a pointer to another table, a literal, a length or 16 | distance, an end-of-block, or an invalid code. For a table 17 | pointer, the low four bits of op is the number of index bits of 18 | that table. For a length or distance, the low four bits of op 19 | is the number of extra bits to get after the code. bits is 20 | the number of bits in this code or part of the code to drop off 21 | of the bit buffer. val is the actual byte to output in the case 22 | of a literal, the base length or distance, or the offset from 23 | the current table to the next table. Each entry is four bytes. */ 24 | typedef struct { 25 | unsigned char op; /* operation, extra bits, table bits */ 26 | unsigned char bits; /* bits in this part of the code */ 27 | unsigned short val; /* offset in table or code value */ 28 | } code; 29 | 30 | /* op values as set by inflate_table(): 31 | 00000000 - literal 32 | 0000tttt - table link, tttt != 0 is the number of table index bits 33 | 0001eeee - length or distance, eeee is the number of extra bits 34 | 01100000 - end of block 35 | 01000000 - invalid code 36 | */ 37 | 38 | /* Maximum size of dynamic tree. The maximum found in a long but non- 39 | exhaustive search was 1004 code structures (850 for length/literals 40 | and 154 for distances, the latter actually the result of an 41 | exhaustive search). The true maximum is not known, but the value 42 | below is more than safe. */ 43 | #define ENOUGH 1440 44 | #define MAXD 154 45 | 46 | /* Type of code to build for inftable() */ 47 | typedef enum { 48 | CODES, 49 | LENS, 50 | DISTS 51 | } codetype; 52 | 53 | extern int inflate_table OF((codetype type, unsigned short FAR *lens, 54 | unsigned codes, code FAR * FAR *table, 55 | unsigned FAR *bits, unsigned short FAR *work)); 56 | -------------------------------------------------------------------------------- /BoxLib/zlib/uncompr.c: -------------------------------------------------------------------------------- 1 | /* uncompr.c -- decompress a memory buffer 2 | * Copyright (C) 1995-2003 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Decompresses the source buffer into the destination buffer. sourceLen is 13 | the byte length of the source buffer. Upon entry, destLen is the total 14 | size of the destination buffer, which must be large enough to hold the 15 | entire uncompressed data. (The size of the uncompressed data must have 16 | been saved previously by the compressor and transmitted to the decompressor 17 | by some mechanism outside the scope of this compression library.) 18 | Upon exit, destLen is the actual size of the compressed buffer. 19 | This function can be used to decompress a whole file at once if the 20 | input file is mmap'ed. 21 | 22 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not 23 | enough memory, Z_BUF_ERROR if there was not enough room in the output 24 | buffer, or Z_DATA_ERROR if the input data was corrupted. 25 | */ 26 | int ZEXPORT uncompress (dest, destLen, source, sourceLen) 27 | Bytef *dest; 28 | uLongf *destLen; 29 | const Bytef *source; 30 | uLong sourceLen; 31 | { 32 | z_stream stream; 33 | int err; 34 | 35 | stream.next_in = (Bytef*)source; 36 | stream.avail_in = (uInt)sourceLen; 37 | /* Check for source > 64K on 16-bit machine: */ 38 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; 39 | 40 | stream.next_out = dest; 41 | stream.avail_out = (uInt)*destLen; 42 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; 43 | 44 | stream.zalloc = (alloc_func)0; 45 | stream.zfree = (free_func)0; 46 | 47 | err = inflateInit(&stream); 48 | if (err != Z_OK) return err; 49 | 50 | err = inflate(&stream, Z_FINISH); 51 | if (err != Z_STREAM_END) { 52 | inflateEnd(&stream); 53 | if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) 54 | return Z_DATA_ERROR; 55 | return err; 56 | } 57 | *destLen = stream.total_out; 58 | 59 | err = inflateEnd(&stream); 60 | return err; 61 | } 62 | -------------------------------------------------------------------------------- /Console模式编译.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/Console模式编译.txt -------------------------------------------------------------------------------- /NBR/BuildBtn.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | // CBuildBtn 5 | 6 | class CBuildBtn : public CButton 7 | { 8 | DECLARE_DYNAMIC(CBuildBtn) 9 | 10 | public: 11 | CBuildBtn(); 12 | virtual ~CBuildBtn(); 13 | 14 | protected: 15 | DECLARE_MESSAGE_MAP() 16 | public: 17 | virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); 18 | void OnSysColorChange(); 19 | void CheckMouse(); 20 | 21 | private: 22 | CBitmap m_hBmp; 23 | BITMAP m_bm; 24 | BOOL m_bInRect; 25 | public: 26 | afx_msg void OnMouseMove(UINT nFlags, CPoint point); 27 | }; 28 | 29 | 30 | -------------------------------------------------------------------------------- /NBR/CertInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class CCertInfo 6 | { 7 | public: 8 | CCertInfo(void); 9 | ~CCertInfo(void); 10 | 11 | BOOL SetLic(void* pBuffer); 12 | void CheckDate(DATE d); 13 | void Clear(void); 14 | 15 | BYTE m_aHash[16]; 16 | int m_nDevID; 17 | CString m_strStart; 18 | CString m_strEnd; 19 | 20 | CBDate m_dateEnd; 21 | CBDate m_dateTimeout; 22 | 23 | BOOL m_bUpdate; 24 | BOOL m_bValid; 25 | 26 | LPCTSTR m_strError; 27 | }; 28 | 29 | -------------------------------------------------------------------------------- /NBR/CertView.cpp: -------------------------------------------------------------------------------- 1 | // CertView.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "NBR.h" 6 | #include "CertView.h" 7 | #include ".\certview.h" 8 | #include ".\logon.h" 9 | 10 | 11 | // CCertView dialog 12 | 13 | IMPLEMENT_DYNAMIC(CCertView, CDialog) 14 | CCertView::CCertView(CWnd* pParent /*=NULL*/) 15 | : CDialog(CCertView::IDD, pParent) 16 | { 17 | } 18 | 19 | CCertView::~CCertView() 20 | { 21 | } 22 | 23 | void CCertView::DoDataExchange(CDataExchange* pDX) 24 | { 25 | CDialog::DoDataExchange(pDX); 26 | DDX_Control(pDX, IDC_UPDATE, m_wndUpdate); 27 | DDX_Control(pDX, IDC_INFO, m_wndInfo); 28 | } 29 | 30 | 31 | BEGIN_MESSAGE_MAP(CCertView, CDialog) 32 | ON_BN_CLICKED(IDC_UPDATE, OnBnClickedUpdate) 33 | END_MESSAGE_MAP() 34 | 35 | void CCertView::ViewCert(void) 36 | { 37 | theApp.LoadLic(); 38 | 39 | if(theApp.m_certinfo.m_strError) 40 | SetDlgItemText(IDC_INFO, GetMessage(CBString(theApp.m_certinfo.m_strError))); 41 | 42 | m_wndUpdate.EnableWindow(!theApp.m_certinfo.m_bValid || theApp.m_certinfo.m_bUpdate); 43 | 44 | if(theApp.m_certinfo.m_nDevID) 45 | { 46 | SetDlgItemInt(IDC_DEVID, theApp.m_certinfo.m_nDevID); 47 | SetDlgItemText(IDC_DATE, theApp.m_certinfo.m_strStart + _T(" to ") + theApp.m_certinfo.m_strEnd); 48 | }else 49 | { 50 | SetDlgItemText(IDC_DEVID, _T("----------")); 51 | SetDlgItemText(IDC_DATE, _T("--------------")); 52 | } 53 | } 54 | 55 | BOOL CCertView::OnInitDialog() 56 | { 57 | CDialog::OnInitDialog(); 58 | 59 | ViewCert(); 60 | 61 | SetWindowText(GetMessage(L"CertInfo")); 62 | SetDlgItemText(IDC_UPDATE, GetMessage(L"Update") + _T(" ...")); 63 | SetDlgItemText(IDOK, GetMessage(L"Close")); 64 | 65 | return TRUE; 66 | } 67 | 68 | void CCertView::OnBnClickedUpdate() 69 | { 70 | CLogon dlg; 71 | dlg.DoModal(); 72 | 73 | ViewCert(); 74 | } 75 | -------------------------------------------------------------------------------- /NBR/CertView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | 6 | // CCertView dialog 7 | 8 | class CCertView : public CDialog 9 | { 10 | DECLARE_DYNAMIC(CCertView) 11 | 12 | public: 13 | CCertView(CWnd* pParent = NULL); // standard constructor 14 | virtual ~CCertView(); 15 | 16 | // Dialog Data 17 | enum { IDD = IDD_CERTVIEW }; 18 | 19 | protected: 20 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 21 | 22 | void ViewCert(void); 23 | 24 | DECLARE_MESSAGE_MAP() 25 | public: 26 | virtual BOOL OnInitDialog(); 27 | CButton m_wndUpdate; 28 | afx_msg void OnBnClickedUpdate(); 29 | CStatic m_wndInfo; 30 | }; 31 | -------------------------------------------------------------------------------- /NBR/DlgLang.cpp: -------------------------------------------------------------------------------- 1 | // DlgLang.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "NBR.h" 6 | #include "DlgLang.h" 7 | #include ".\dlglang.h" 8 | 9 | 10 | // CDlgLang dialog 11 | 12 | IMPLEMENT_DYNAMIC(CDlgLang, CDialog) 13 | CDlgLang::CDlgLang(CWnd* pParent /*=NULL*/) 14 | : CDialog(CDlgLang::IDD, pParent) 15 | { 16 | } 17 | 18 | CDlgLang::~CDlgLang() 19 | { 20 | } 21 | 22 | void CDlgLang::DoDataExchange(CDataExchange* pDX) 23 | { 24 | CDialog::DoDataExchange(pDX); 25 | DDX_Control(pDX, IDC_LANGUAGE, m_wndLang); 26 | DDX_Control(pDX, IDOK, m_wndOK); 27 | } 28 | 29 | 30 | BEGIN_MESSAGE_MAP(CDlgLang, CDialog) 31 | ON_LBN_SELCHANGE(IDC_LANGUAGE, OnLbnSelchangeLanguage) 32 | ON_LBN_DBLCLK(IDC_LANGUAGE, OnLbnDblclkLanguage) 33 | END_MESSAGE_MAP() 34 | 35 | 36 | // CDlgLang message handlers 37 | 38 | BOOL CDlgLang::OnInitDialog() 39 | { 40 | CDialog::OnInitDialog(); 41 | 42 | for(int i = 0; i < (int)theApp.m_arrayLang.GetCount(); i ++) 43 | m_wndLang.AddString(CString(theApp.m_arrayLang[i])); 44 | 45 | return TRUE; 46 | } 47 | 48 | void CDlgLang::OnCancel() 49 | { 50 | if(theApp.m_nLanguage != -1) 51 | CDialog::OnCancel(); 52 | } 53 | 54 | void CDlgLang::OnOK() 55 | { 56 | if(theApp.m_nLanguage != -1) 57 | CDialog::OnOK(); 58 | } 59 | 60 | void CDlgLang::OnLbnSelchangeLanguage() 61 | { 62 | theApp.setLanguage(m_wndLang.GetCurSel()); 63 | 64 | SetWindowText(GetMessage(L"SelLang")); 65 | SetDlgItemText(IDOK, GetMessage(L"OK")); 66 | 67 | m_wndOK.EnableWindow(); 68 | } 69 | 70 | void CDlgLang::OnLbnDblclkLanguage() 71 | { 72 | OnLbnSelchangeLanguage(); 73 | OnOK(); 74 | } 75 | -------------------------------------------------------------------------------- /NBR/DlgLang.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | 5 | // CDlgLang dialog 6 | 7 | class CDlgLang : public CDialog 8 | { 9 | DECLARE_DYNAMIC(CDlgLang) 10 | 11 | public: 12 | CDlgLang(CWnd* pParent = NULL); // standard constructor 13 | virtual ~CDlgLang(); 14 | 15 | // Dialog Data 16 | enum { IDD = IDD_LANGUAGE }; 17 | 18 | protected: 19 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 20 | 21 | DECLARE_MESSAGE_MAP() 22 | public: 23 | CListBox m_wndLang; 24 | virtual BOOL OnInitDialog(); 25 | 26 | protected: 27 | virtual void OnCancel(); 28 | virtual void OnOK(); 29 | public: 30 | afx_msg void OnLbnSelchangeLanguage(); 31 | CButton m_wndOK; 32 | afx_msg void OnLbnDblclkLanguage(); 33 | }; 34 | -------------------------------------------------------------------------------- /NBR/LogDialog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Worker.h" 4 | 5 | 6 | #define WM_WRITELOG (WM_USER + 1000) 7 | 8 | // CLogDialog dialog 9 | 10 | class CLogDialog : public CDialog 11 | { 12 | DECLARE_DYNAMIC(CLogDialog) 13 | 14 | public: 15 | CLogDialog(CWnd* pParent = NULL); // standard constructor 16 | virtual ~CLogDialog(); 17 | 18 | // Dialog Data 19 | enum { IDD = IDD_LOG }; 20 | 21 | BOOL WriteLog(LPCTSTR szText); 22 | 23 | private: 24 | CEdit m_wndOutput; 25 | CButton m_wndCancel; 26 | 27 | CRect m_rcEdit, m_rcButton; 28 | CPoint m_ptEdit; 29 | BOOL m_bInit; 30 | BOOL m_bWantClose; 31 | 32 | CWorker m_th; 33 | 34 | protected: 35 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 36 | virtual BOOL OnInitDialog(); 37 | virtual void OnOK(); 38 | 39 | DECLARE_MESSAGE_MAP() 40 | public: 41 | afx_msg void OnSize(UINT nType, int cx, int cy); 42 | afx_msg void OnBnClickedCancel(); 43 | afx_msg LRESULT OnWriteLog(WPARAM wParam, LPARAM lParam); 44 | afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); 45 | }; 46 | -------------------------------------------------------------------------------- /NBR/Logon.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | 5 | // CLogon dialog 6 | 7 | class CLogon : public CDialog 8 | { 9 | DECLARE_DYNAMIC(CLogon) 10 | 11 | public: 12 | CLogon(CWnd* pParent = NULL); // standard constructor 13 | virtual ~CLogon(); 14 | 15 | // Dialog Data 16 | enum { IDD = IDD_LOGON }; 17 | 18 | protected: 19 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 20 | 21 | DECLARE_MESSAGE_MAP() 22 | public: 23 | virtual BOOL OnInitDialog(); 24 | CEdit m_wndUser; 25 | CEdit m_wndPassword; 26 | afx_msg void OnBnClickedRegister(); 27 | protected: 28 | virtual void OnOK(); 29 | }; 30 | -------------------------------------------------------------------------------- /NBR/NBR.h: -------------------------------------------------------------------------------- 1 | // NBR.h : main header file for the PROJECT_NAME application 2 | // 3 | 4 | #pragma once 5 | 6 | #ifndef __AFXWIN_H__ 7 | #error include 'stdafx.h' before including this file for PCH 8 | #endif 9 | 10 | #include "resource.h" // main symbols 11 | #include 12 | //#include "CertInfo.h" 13 | #include 14 | #include 15 | #include 16 | 17 | // CNBRApp: 18 | // See NBR.cpp for the implementation of this class 19 | // 20 | 21 | class CNBRApp : public CWinApp 22 | { 23 | public: 24 | CNBRApp(); 25 | 26 | // Overrides 27 | public: 28 | virtual BOOL InitInstance(); 29 | 30 | CBComPtr m_pSysInfo; 31 | CBComPtr m_pMsgMan; 32 | CBComPtr m_pMsgColl; 33 | CAtlArray m_arrayLang; 34 | int m_nLanguage; 35 | 36 | void setLanguage(int l) 37 | { 38 | m_nLanguage = l; 39 | m_pMsgColl.Release(); 40 | m_pMsgMan->GetLanguage(m_arrayLang[m_nLanguage], &m_pMsgColl); 41 | } 42 | 43 | CBBlockStream m_mStream; 44 | BYTE m_aHash[16]; 45 | // CCertInfo m_certinfo; 46 | 47 | void LoadLic(void); 48 | 49 | CString m_strLogon; 50 | CString m_strBasePath; 51 | 52 | CString m_strStartPath; 53 | BOOL m_bBuild; 54 | 55 | // Implementation 56 | 57 | DECLARE_MESSAGE_MAP() 58 | }; 59 | 60 | extern CNBRApp theApp; 61 | 62 | CString inline GetMessage(LPCWSTR pName) 63 | { 64 | return CString(theApp.m_pMsgColl->GetMessage(pName)); 65 | } 66 | -------------------------------------------------------------------------------- /NBR/NBR.vcproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "relative:NBR" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /NBR/SiDlg.cpp: -------------------------------------------------------------------------------- 1 | // SiDlg.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "NBR.h" 6 | #include "sidlg.h" 7 | 8 | 9 | // CSiDlg dialog 10 | 11 | IMPLEMENT_DYNAMIC(CSiDlg, CDialog) 12 | CSiDlg::CSiDlg(CWnd* pParent /*=NULL*/) 13 | : CDialog(CSiDlg::IDD, pParent) 14 | { 15 | } 16 | 17 | CSiDlg::~CSiDlg() 18 | { 19 | } 20 | 21 | void CSiDlg::DoDataExchange(CDataExchange* pDX) 22 | { 23 | CDialog::DoDataExchange(pDX); 24 | DDX_Control(pDX, IDC_SILIST, m_wndSiList); 25 | } 26 | 27 | 28 | BEGIN_MESSAGE_MAP(CSiDlg, CDialog) 29 | END_MESSAGE_MAP() 30 | 31 | 32 | // CSiDlg message handlers 33 | 34 | BOOL CSiDlg::OnInitDialog() 35 | { 36 | CDialog::OnInitDialog(); 37 | 38 | m_wndSiList.ModifyStyle(0, LVS_REPORT); 39 | m_wndSiList.InsertColumn(0, GetMessage(L"Item"), LVCFMT_LEFT, 100); 40 | m_wndSiList.InsertColumn(1, GetMessage(L"Value"), LVCFMT_LEFT, 340); 41 | m_wndSiList.SetExtendedStyle(LVS_EX_FULLROWSELECT); 42 | 43 | long nCount, i; 44 | CString k, v; 45 | 46 | theApp.m_pSysInfo->get_Count(&nCount); 47 | 48 | for(i = 0; i < nCount; i ++) 49 | { 50 | theApp.m_pSysInfo->GetAssoc(i, k, v); 51 | m_wndSiList.InsertItem(i, k); 52 | m_wndSiList.SetItemText(i, 1, v); 53 | } 54 | 55 | SetWindowText(GetMessage(L"SysInfo")); 56 | SetDlgItemText(IDOK, GetMessage(L"Close")); 57 | 58 | return TRUE; // return TRUE unless you set the focus to a control 59 | // EXCEPTION: OCX Property Pages should return FALSE 60 | } 61 | -------------------------------------------------------------------------------- /NBR/SiDlg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | 5 | // CSiDlg dialog 6 | 7 | class CSiDlg : public CDialog 8 | { 9 | DECLARE_DYNAMIC(CSiDlg) 10 | 11 | public: 12 | CSiDlg(CWnd* pParent = NULL); // standard constructor 13 | virtual ~CSiDlg(); 14 | 15 | // Dialog Data 16 | enum { IDD = IDD_SYSINFO }; 17 | 18 | protected: 19 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 20 | 21 | DECLARE_MESSAGE_MAP() 22 | public: 23 | CListCtrl m_wndSiList; 24 | virtual BOOL OnInitDialog(); 25 | }; 26 | -------------------------------------------------------------------------------- /NBR/Worker.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NBR/Worker.cpp -------------------------------------------------------------------------------- /NBR/ZipFile.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #ifndef Z_BUFSIZE 9 | #define Z_BUFSIZE 16384 10 | #endif 11 | 12 | // CZip command target 13 | 14 | class CZipFile : public CFile 15 | { 16 | public: 17 | CZipFile(); 18 | 19 | virtual ~CZipFile(); 20 | 21 | virtual BOOL Open(LPCTSTR lpszFileName, UINT nOpenFlags, CFileException* pError = NULL); 22 | BOOL Open(HANDLE hFile, UINT nOpenFlags); 23 | 24 | virtual UINT Read(void* lpBuf, UINT nCount); 25 | virtual void Write(const void* lpBuf, UINT nCount); 26 | 27 | virtual void Close(); 28 | 29 | void SetKey(const unsigned char *data) 30 | { 31 | RC4_set_key(&m_key, MD5_DIGEST_LENGTH, data); 32 | } 33 | 34 | private: 35 | void clear(); 36 | UINT RC4Read(void* lpBuf, UINT nCount); 37 | void RC4Write(const void* lpBuf, UINT nCount); 38 | 39 | Byte m_Buffer[Z_BUFSIZE]; 40 | z_stream stream; 41 | BOOL m_bEof; 42 | UINT m_nOpenFlags; 43 | 44 | RC4_KEY m_key; 45 | }; 46 | -------------------------------------------------------------------------------- /NBR/res/NBR.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NBR/res/NBR.ico -------------------------------------------------------------------------------- /NBR/res/NBR.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | NBR 10 | 11 | 12 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NBR/res/NBR.rc2: -------------------------------------------------------------------------------- 1 | // 2 | // NBR.RC2 - resources Microsoft Visual C++ does not edit directly 3 | // 4 | 5 | #ifdef APSTUDIO_INVOKED 6 | #error this file is not editable by Microsoft Visual C++ 7 | #endif //APSTUDIO_INVOKED 8 | 9 | 10 | ///////////////////////////////////////////////////////////////////////////// 11 | // Add manually edited resources here... 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | -------------------------------------------------------------------------------- /NBR/res/build.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NBR/res/build.bmp -------------------------------------------------------------------------------- /NBR/res/icon1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NBR/res/icon1.ico -------------------------------------------------------------------------------- /NBR/res/logo.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NBR/res/logo.bmp -------------------------------------------------------------------------------- /NBR/res/name.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NBR/res/name.bmp -------------------------------------------------------------------------------- /NBR/res/nbFile.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NBR/res/nbFile.ico -------------------------------------------------------------------------------- /NBR/res/nbLib.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NBR/res/nbLib.ico -------------------------------------------------------------------------------- /NBR/res/pbnb.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NBR/res/pbnb.bmp -------------------------------------------------------------------------------- /NBR/res/title.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NBR/res/title.bmp -------------------------------------------------------------------------------- /NBR/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // NBR.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | 8 | -------------------------------------------------------------------------------- /NBR/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, 3 | // but are changed infrequently 4 | 5 | #pragma once 6 | 7 | #ifndef VC_EXTRALEAN 8 | #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers 9 | #endif 10 | 11 | // Modify the following defines if you have to target a platform prior to the ones specified below. 12 | // Refer to MSDN for the latest info on corresponding values for different platforms. 13 | #ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later. 14 | #define WINVER 0x0500 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. 15 | #endif 16 | 17 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later. 18 | #define _WIN32_WINNT 0x0500 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. 19 | #endif 20 | 21 | #ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. 22 | #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. 23 | #endif 24 | 25 | #ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later. 26 | #define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later. 27 | #endif 28 | 29 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit 30 | 31 | // turns off MFC's hiding of some common and often safely ignored warning messages 32 | #define _AFX_ALL_WARNINGS 33 | 34 | #include // MFC core and standard components 35 | #include // MFC extensions 36 | #include // MFC Automation classes 37 | 38 | #include // MFC support for Internet Explorer 4 Common Controls 39 | #ifndef _AFX_NO_AFXCMN_SUPPORT 40 | #include // MFC support for Windows Common Controls 41 | #endif // _AFX_NO_AFXCMN_SUPPORT 42 | #include 43 | -------------------------------------------------------------------------------- /NetBox.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NetBox.txt -------------------------------------------------------------------------------- /NetBox2/BoxApplication.cpp: -------------------------------------------------------------------------------- 1 | // BoxApplication.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "NetBox2.h" 6 | #include "BoxApplication.h" 7 | 8 | // CBoxApplication 9 | 10 | IMPLEMENT_DYNAMIC(CBoxApplication, CBoxSafeObject) 11 | 12 | BEGIN_DISPATCH_MAP(CBoxApplication, CBoxSafeObject) 13 | DISP_PROPERTY_PARAM_ID(CBoxApplication, "Item", 0, get_Item, put_Item, VT_VARIANT, VTS_VARIANT) 14 | 15 | DISP_PROPERTY_EX(CBoxApplication, "Contents", get_Contents, SetNotSupported, VT_DISPATCH) 16 | DISP_PROPERTY_EX_ID(CBoxApplication, "_NewEnum", DISPID_NEWENUM, get__NewEnum, SetNotSupported, VT_UNKNOWN) 17 | 18 | DISP_FUNCTION(CBoxApplication, "Lock", Lock, VT_EMPTY, VTS_NONE) 19 | DISP_FUNCTION(CBoxApplication, "Unlock", Unlock, VT_EMPTY, VTS_NONE) 20 | DISP_PROPERTY_EX(CBoxApplication, "ApplicationID", get_ApplicationID, SetNotSupported, VT_BSTR) 21 | END_DISPATCH_MAP() 22 | 23 | // CBoxApplication message handlers 24 | 25 | LPDISPATCH CBoxApplication::get_Contents(void) 26 | { 27 | m_pContents->AddRef(); 28 | return m_pContents; 29 | } 30 | 31 | VARIANT CBoxApplication::get_Item(VARIANT& varKey) 32 | { 33 | while(varKey.vt == (VT_VARIANT | VT_BYREF)) 34 | varKey = *varKey.pvarVal; 35 | 36 | VARIANT var; 37 | HRESULT hr; 38 | 39 | VariantInit(&var); 40 | hr = m_pContents->get_Item(varKey, &var); 41 | if(FAILED(hr))AfxThrowOleException(hr); 42 | 43 | return var; 44 | } 45 | 46 | void CBoxApplication::put_Item(VARIANT& varKey, VARIANT& var) 47 | { 48 | while(varKey.vt == (VT_VARIANT | VT_BYREF)) 49 | varKey = *varKey.pvarVal; 50 | 51 | while(var.vt == (VT_VARIANT | VT_BYREF)) 52 | var = *var.pvarVal; 53 | 54 | HRESULT hr; 55 | 56 | hr = m_pContents->put_Item(varKey, var); 57 | if(FAILED(hr))AfxThrowOleException(hr); 58 | } 59 | 60 | LPUNKNOWN CBoxApplication::get__NewEnum(void) 61 | { 62 | LPUNKNOWN pEnum = NULL; 63 | 64 | m_pContents->get__NewEnum(&pEnum); 65 | return pEnum; 66 | } 67 | 68 | void CBoxApplication::Lock(void) 69 | { 70 | theApp.m_pSystem->Lock(m_strHostKey); 71 | } 72 | 73 | void CBoxApplication::Unlock(void) 74 | { 75 | theApp.m_pSystem->Unlock(m_strHostKey); 76 | } 77 | 78 | BSTR CBoxApplication::get_ApplicationID(void) 79 | { 80 | return m_strHostKey.AllocSysString(); 81 | } -------------------------------------------------------------------------------- /NetBox2/BoxApplication.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | // CBoxApplication command target 7 | 8 | class CBoxApplication : public CBoxSafeObject 9 | { 10 | DECLARE_DYNAMIC(CBoxApplication) 11 | 12 | public: 13 | CBoxApplication() 14 | { 15 | m_pContents.CreateInstance(); 16 | m_pContents->put_ArrayMode(0); 17 | } 18 | 19 | public: 20 | afx_msg VARIANT get_Item(VARIANT& varKey); 21 | afx_msg void put_Item(VARIANT& varKey, VARIANT& var); 22 | afx_msg LPDISPATCH get_Contents(void); 23 | 24 | afx_msg LPUNKNOWN get__NewEnum(void); 25 | 26 | afx_msg void Lock(void); 27 | afx_msg void Unlock(void); 28 | afx_msg BSTR get_ApplicationID(void); 29 | 30 | CString m_strHostKey; 31 | 32 | DECLARE_DISPATCH_MAP() 33 | 34 | public: 35 | CBComPtr m_pContents; 36 | }; 37 | -------------------------------------------------------------------------------- /NetBox2/BoxArguments.cpp: -------------------------------------------------------------------------------- 1 | // BoxArguments.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "BoxArguments.h" 6 | 7 | #ifdef _DEBUG 8 | #define new DEBUG_NEW 9 | #endif 10 | 11 | // CBoxArguments 12 | 13 | IMPLEMENT_DYNCREATE(CBoxArguments, CBoxSafeObject) 14 | 15 | BEGIN_DISPATCH_MAP(CBoxArguments, CBoxSafeObject) 16 | DISP_PROPERTY_PARAM_ID(CBoxArguments, "Item", 0, get_Item, SetNotSupported, VT_BSTR, VTS_I4) 17 | DISP_PROPERTY_EX(CBoxArguments, "Length", get_Length, SetNotSupported, VT_I4) 18 | DISP_FUNCTION(CBoxArguments, "Count", get_Length, VT_I4, VTS_NONE) 19 | DISP_PROPERTY_EX(CBoxArguments, "CommandLine", GetNotSupported, put_CommandLine, VT_BSTR) 20 | END_DISPATCH_MAP() 21 | 22 | // CBoxArguments message handlers 23 | 24 | BSTR CBoxArguments::get_Item(long ItemNo) 25 | { 26 | if(ItemNo < 0 || ItemNo >= m_astrArgs.GetCount()) 27 | return NULL; 28 | 29 | return m_astrArgs[ItemNo].AllocSysString(); 30 | } 31 | 32 | long CBoxArguments::get_Length(void) 33 | { 34 | return (long)m_astrArgs.GetCount(); 35 | } 36 | 37 | void CBoxArguments::put_CommandLine(LPCTSTR pstrCommandLine) 38 | { 39 | LPCTSTR pstr; 40 | BOOL bIsLong; 41 | 42 | m_astrArgs.RemoveAll(); 43 | 44 | while(pstrCommandLine && *pstrCommandLine) 45 | { 46 | while(IsBlankChar(*pstrCommandLine)) 47 | pstrCommandLine ++; 48 | 49 | if(bIsLong = (*pstrCommandLine == '\"')) 50 | pstrCommandLine ++; 51 | 52 | pstr = pstrCommandLine; 53 | 54 | if(bIsLong) 55 | while(*pstrCommandLine != 0 && *pstrCommandLine != '\"') 56 | pstrCommandLine ++; 57 | else 58 | while(*pstrCommandLine != 0 && !IsBlankChar(*pstrCommandLine)) 59 | pstrCommandLine ++; 60 | 61 | if(pstrCommandLine != pstr) 62 | { 63 | CString str; 64 | 65 | str.SetString(pstr, (int)(pstrCommandLine - pstr)); 66 | m_astrArgs.Add(str); 67 | } 68 | 69 | if(bIsLong && *pstrCommandLine == '\"') 70 | pstrCommandLine ++; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /NetBox2/BoxArguments.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | // CBoxArguments command target 6 | 7 | class CBoxArguments : public CBoxSafeObject 8 | { 9 | DECLARE_DYNCREATE(CBoxArguments) 10 | 11 | public: 12 | CStringArray m_astrArgs; 13 | 14 | public: 15 | afx_msg BSTR get_Item(long ItemNo); 16 | afx_msg long get_Length(void); 17 | afx_msg void put_CommandLine(LPCTSTR pstrCommandLine); 18 | DECLARE_DISPATCH_MAP() 19 | }; 20 | -------------------------------------------------------------------------------- /NetBox2/BoxArray.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BoxBinPtr.h" 4 | 5 | class CBoxArray 6 | { 7 | public: 8 | 9 | CBoxArray(void) : 10 | m_pData(NULL), 11 | m_nSize(0) 12 | { 13 | } 14 | 15 | ~CBoxArray(void) 16 | { 17 | if(m_pData != NULL) 18 | delete m_pData; 19 | } 20 | 21 | void Clear(void) 22 | { 23 | if(m_pData != NULL) 24 | delete m_pData; 25 | 26 | m_pData = NULL; 27 | m_nSize = 0; 28 | } 29 | 30 | void SetData(void * pData, int nSize) 31 | { 32 | Alloc(nSize); 33 | 34 | if(m_pData != NULL) 35 | CopyMemory(m_pData, pData, nSize); 36 | } 37 | 38 | void Alloc(int nSize) 39 | { 40 | Clear(); 41 | 42 | if(nSize != 0) 43 | { 44 | m_pData = new BYTE[nSize]; 45 | m_nSize = nSize; 46 | } 47 | } 48 | 49 | VARIANT GetVariant(void) 50 | { 51 | 52 | if(m_pData == NULL) 53 | AfxThrowMemoryException(); 54 | 55 | CBoxBinPtr varPtr(m_nSize); 56 | 57 | CopyMemory(varPtr, m_pData, m_nSize); 58 | 59 | return varPtr; 60 | } 61 | 62 | operator VARIANT(void) 63 | { 64 | return GetVariant(); 65 | } 66 | 67 | void SetVariant(VARIANT& v, int nSize = -1) 68 | { 69 | CBoxBinPtr varPtr(v); 70 | 71 | if(nSize != -1 && nSize != varPtr.m_nSize) 72 | AfxThrowOleException(TYPE_E_TYPEMISMATCH); 73 | 74 | SetData(varPtr, varPtr.m_nSize); 75 | } 76 | 77 | void operator=(VARIANT& v) 78 | { 79 | SetVariant(v); 80 | } 81 | 82 | BYTE * m_pData; 83 | int m_nSize; 84 | }; 85 | 86 | 87 | -------------------------------------------------------------------------------- /NetBox2/BoxCacheNode.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BoxLRUCache.h" 4 | 5 | class CBoxCacheNode : public CBoxBaseObject, 6 | public CBoxLRUCacheNode 7 | { 8 | public: 9 | CBoxCacheNode() : 10 | m_pBuffer(NULL), 11 | m_nSize(0) 12 | { 13 | } 14 | 15 | ~CBoxCacheNode(void) 16 | { 17 | if(m_pBuffer != NULL) 18 | delete m_pBuffer; 19 | } 20 | 21 | public: 22 | BYTE* m_pBuffer; 23 | int m_nSize; 24 | SYSTEMTIME m_tm; 25 | CString m_strTime; 26 | }; 27 | 28 | class CBoxCacheFile : public CMemFile 29 | { 30 | public: 31 | CBoxCacheFile(CBoxCacheNode* pNode) 32 | { 33 | m_pNode = pNode; 34 | 35 | Attach(m_pNode->m_pBuffer, m_pNode->m_nSize); 36 | } 37 | 38 | SYSTEMTIME GetFileTime(void) 39 | { 40 | return m_pNode->m_tm; 41 | } 42 | 43 | void GetFileTimeString(CString& strTime) 44 | { 45 | strTime = m_pNode->m_strTime; 46 | } 47 | 48 | private: 49 | CBoxObject m_pNode; 50 | }; 51 | -------------------------------------------------------------------------------- /NetBox2/BoxCachePool.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "BoxFile.h" 3 | #include "BoxCacheNode.h" 4 | #include "BoxLRUCache.h" 5 | 6 | class CBoxCachePool : public CBoxFile 7 | { 8 | public: 9 | CBoxCachePool(CBoxFile* pOldFile); 10 | ~CBoxCachePool(void); 11 | 12 | void RemoveAll(void) 13 | { 14 | CSingleLock l(&m_cs, TRUE); 15 | 16 | m_cache.RemoveAll(); 17 | } 18 | 19 | public: 20 | virtual CFile* Open(LPCTSTR pstrName); 21 | virtual SYSTEMTIME GetFileTime(CFile* pFile); 22 | virtual void GetFileTimeString(CFile* pFile, CString& strTime); 23 | 24 | void SetCacheNode(LPCTSTR pstrName, CMemFile* pFile, SYSTEMTIME tm); 25 | 26 | static void CheckOpenFile(LPCTSTR pstrFile, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwFlagsAndAttributes, HANDLE& hd); 27 | 28 | CBoxFile* m_pOldFile; 29 | 30 | private: 31 | 32 | CCriticalSection m_cs; 33 | CBoxLRUCache m_cache; 34 | }; 35 | -------------------------------------------------------------------------------- /NetBox2/BoxCommand.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "NetBox2.h" 3 | #include "BoxObject.h" 4 | #include "BoxSystem.h" 5 | #include "BoxCommand.h" 6 | #include "BoxScript.h" 7 | #include "BoxFile.h" 8 | #include 9 | 10 | static CBoxScript* s_pNowScript = NULL; 11 | 12 | BOOL WINAPI CBoxCommand::CtrlHandler(DWORD fdwCtrlType) 13 | { 14 | if(fdwCtrlType == CTRL_C_EVENT) 15 | { 16 | s_pNowScript->Interrupt(_T("The script was canceled by the user.")); 17 | return TRUE; 18 | } 19 | 20 | return FALSE; 21 | } 22 | 23 | void CBoxCommand::Start(void) 24 | { 25 | CBComPtr pArgs; 26 | CString str; 27 | 28 | pArgs.Attach(theApp.get_Arguments()); 29 | m_pConsole.Attach(theApp.get_Console()); 30 | m_strBasePath = _T("\\"); 31 | 32 | m_pConsole->WriteLine(CBoxSystem::getVersion()); 33 | m_pConsole->WriteLine(""); 34 | 35 | while(TRUE) 36 | { 37 | m_pConsole->WriteText(_T("#")); 38 | 39 | pArgs->put_CommandLine((BSTR)(LPCWSTR)CBString(m_pConsole->ReadLine())); 40 | 41 | if(pArgs->GetCount()) 42 | { 43 | str = pArgs->GetString(0); 44 | 45 | if(!str.CompareNoCase(_T("exit"))) 46 | return; 47 | else 48 | { 49 | CBoxObject pScript; 50 | int nError; 51 | 52 | pScript.CreateInstance(); 53 | 54 | if(!IsBoxFile(str.Right(4))) 55 | str += ".box"; 56 | 57 | nError = pScript->Load(m_strBasePath + str); 58 | if(nError == 404) 59 | m_pConsole->WriteLine("Bad Command"); 60 | 61 | if(nError == 0) 62 | { 63 | g_pFile->m_strAppName = str; 64 | 65 | pScript->AddNameItem(_T("Shell"), (LPDISPATCH)theApp.GetInterface(&IID_IDispatch)); 66 | pScript->AddNameItem(_T("NetBox"), theApp.m_pSystem); 67 | 68 | s_pNowScript = pScript; 69 | SetConsoleCtrlHandler(CtrlHandler, TRUE); 70 | nError = pScript->Run(); 71 | SetConsoleCtrlHandler(CtrlHandler, FALSE); 72 | s_pNowScript = NULL; 73 | } 74 | 75 | if(nError != 0 && nError != 404) 76 | { 77 | CBoxScript::CScriptError &error = pScript->GetErrorMessage(); 78 | 79 | str = error.m_strSource; 80 | str += _T('\n'); 81 | 82 | if(error.m_sCode != 0) 83 | str.AppendFormat(_T("Error Number: %08X\nFile: "), error.m_sCode); 84 | else str.Append(_T("File: "), 6); 85 | str += error.m_strFile; 86 | str.AppendFormat(_T("\nLine: %d\nDescription: "), error.m_nLine); 87 | str += error.m_strDescription; 88 | 89 | m_pConsole->WriteLine(""); 90 | m_pConsole->WriteLine(str); 91 | m_pConsole->WriteLine(""); 92 | } 93 | } 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /NetBox2/BoxCommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CBoxCommand 4 | { 5 | public: 6 | void Start(void); 7 | 8 | private: 9 | static BOOL WINAPI CBoxCommand::CtrlHandler(DWORD fdwCtrlType); 10 | CBComPtr m_pConsole; 11 | CString m_strBasePath; 12 | }; 13 | -------------------------------------------------------------------------------- /NetBox2/BoxConsole.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | // CBoxConsole command target 6 | 7 | class CBoxConsole : public CBoxSafeObject 8 | { 9 | DECLARE_DYNAMIC(CBoxConsole) 10 | public: 11 | CBoxConsole(); 12 | 13 | void AllocConsole(); 14 | 15 | CString ReadString(void); 16 | 17 | public: 18 | afx_msg void Write(LPCTSTR pstr); 19 | afx_msg void WriteLine(LPCTSTR pstr); 20 | afx_msg void WriteBlankLines(long nLine); 21 | afx_msg long Read(void); 22 | afx_msg BSTR ReadLine(void); 23 | afx_msg BSTR ReadPassword(void); 24 | afx_msg void put_Caption(LPCTSTR pstrTitle); 25 | afx_msg BSTR get_Caption(); 26 | 27 | DECLARE_DISPATCH_MAP() 28 | 29 | private: 30 | HANDLE m_hStdin, m_hStdout; 31 | }; 32 | -------------------------------------------------------------------------------- /NetBox2/BoxContents.cpp: -------------------------------------------------------------------------------- 1 | // BoxContents.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "BoxContents.h" 6 | 7 | 8 | // CBoxContents 9 | 10 | IMPLEMENT_DYNAMIC(CBoxContents, CBoxSafeObject) 11 | 12 | BEGIN_DISPATCH_MAP(CBoxContents, CBoxSafeObject) 13 | DISP_PROPERTY_PARAM_ID(CBoxContents, "Item", 0, get_Item, put_Item, VT_VARIANT, VTS_VARIANT) 14 | 15 | DISP_PROPERTY_EX(CBoxContents, "Contents", get_Contents, SetNotSupported, VT_DISPATCH) 16 | DISP_PROPERTY_EX_ID(CBoxContents, "_NewEnum", DISPID_NEWENUM, get__NewEnum, SetNotSupported, VT_UNKNOWN) 17 | END_DISPATCH_MAP() 18 | 19 | // CBoxContents message handlers 20 | 21 | LPDISPATCH CBoxContents::get_Contents(void) 22 | { 23 | m_pContents->ExternalAddRef(); 24 | return m_pContents; 25 | } 26 | 27 | VARIANT CBoxContents::get_Item(VARIANT& varKey) 28 | { 29 | return m_pContents->get_Item(varKey); 30 | } 31 | 32 | void CBoxContents::put_Item(VARIANT& varKey, VARIANT& var) 33 | { 34 | m_pContents->put_Item(varKey, var); 35 | } 36 | 37 | LPUNKNOWN CBoxContents::get__NewEnum(void) 38 | { 39 | return m_pContents->get__NewEnum(); 40 | } 41 | 42 | -------------------------------------------------------------------------------- /NetBox2/BoxContents.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "BoxObject.h" 5 | #include "BoxDictionary.h" 6 | 7 | // CBoxContents command target 8 | 9 | class CBoxContents : public CBoxSafeObject 10 | { 11 | DECLARE_DYNAMIC(CBoxContents) 12 | public: 13 | CBoxContents(void) 14 | { 15 | m_pContents.CreateInstance(); 16 | } 17 | 18 | template 19 | void SetValue(LPCTSTR pstrKey, const TYPE value) 20 | { 21 | m_pContents->SetValue(pstrKey, value); 22 | } 23 | 24 | public: 25 | afx_msg VARIANT get_Item(VARIANT& varKey); 26 | afx_msg void put_Item(VARIANT& varKey, VARIANT& var); 27 | afx_msg LPDISPATCH get_Contents(void); 28 | 29 | afx_msg LPUNKNOWN get__NewEnum(void); 30 | 31 | DECLARE_DISPATCH_MAP() 32 | 33 | public: 34 | CBoxObject m_pContents; 35 | }; 36 | 37 | 38 | -------------------------------------------------------------------------------- /NetBox2/BoxDES.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | // CBoxDES command target 6 | 7 | class CBoxDES : public CBoxSafeObject 8 | { 9 | DECLARE_DYNCREATE(CBoxDES) 10 | 11 | public: 12 | CBoxDES(void); 13 | 14 | public: 15 | afx_msg VARIANT Encrypt(VARIANT& varData); 16 | afx_msg VARIANT Decrypt(VARIANT& varData); 17 | afx_msg void GenerateKey(void); 18 | afx_msg void GenerateIV(void); 19 | 20 | afx_msg void Clear(void); 21 | 22 | afx_msg VARIANT get_IV(void); 23 | afx_msg void put_IV(VARIANT& varIV); 24 | afx_msg VARIANT get_Key(void); 25 | afx_msg void put_Key(VARIANT& varKey); 26 | 27 | afx_msg long get_Mode(void); 28 | afx_msg void put_Mode(long nMode); 29 | 30 | afx_msg long get_KeySize(void); 31 | afx_msg long get_BlockSize(void); 32 | 33 | DECLARE_DISPATCH_MAP() 34 | 35 | private: 36 | int do_des(BYTE* in, BYTE* out, int nSize, BOOL e) 37 | { 38 | switch(m_nMode) 39 | { 40 | case 0: 41 | des_ecb_encrypt((des_cblock*)in, (des_cblock*)out, m_desKey, e); 42 | return DES_KEY_SZ; 43 | case 1: 44 | { 45 | int num = 0; 46 | 47 | des_ofb64_encrypt(in, out, nSize, m_desKey, &m_aIV, &num); 48 | } 49 | return nSize; 50 | case 2: 51 | des_ncbc_encrypt(in, out, nSize, m_desKey, &m_aIV, e); 52 | return nSize; 53 | case 3: 54 | { 55 | int num = 0; 56 | 57 | des_cfb64_encrypt(in, out, nSize, m_desKey, &m_aIV, &num, e); 58 | } 59 | return nSize; 60 | } 61 | 62 | return -1; 63 | } 64 | 65 | des_key_schedule m_desKey; 66 | 67 | des_cblock m_aKey; 68 | des_cblock m_aIV; 69 | long m_nMode; 70 | }; 71 | 72 | 73 | -------------------------------------------------------------------------------- /NetBox2/BoxDictEnum.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "BoxDictEnum.h" 3 | 4 | CBoxDictEnum::CBoxDictEnum(CBoxDictionary* pDict) : m_dwRef(1), m_nPos(0) 5 | { 6 | m_pDict = pDict; 7 | } 8 | 9 | CBoxDictEnum::CBoxDictEnum(CBoxDictEnum* pEnum) : m_dwRef(1) 10 | { 11 | m_pDict = pEnum->m_pDict; 12 | m_nPos = pEnum->m_nPos; 13 | } 14 | 15 | CBoxDictEnum::~CBoxDictEnum(void) 16 | { 17 | } 18 | 19 | STDMETHODIMP_(ULONG) CBoxDictEnum::AddRef() 20 | { 21 | return InterlockedIncrement(&m_dwRef); 22 | } 23 | 24 | STDMETHODIMP_(ULONG) CBoxDictEnum::Release() 25 | { 26 | if (m_dwRef == 0) 27 | return 0; 28 | 29 | LONG lResult = InterlockedDecrement(&m_dwRef); 30 | if (lResult == 0) 31 | delete this; 32 | 33 | return lResult; 34 | } 35 | 36 | STDMETHODIMP CBoxDictEnum::QueryInterface(REFIID iid, LPVOID far* ppvObj) 37 | { 38 | *ppvObj = NULL; 39 | 40 | if (IsEqualIID(iid, IID_IUnknown)) 41 | *ppvObj = (IUnknown*)this; 42 | else if (IsEqualIID(iid, IID_IEnumVARIANT)) 43 | *ppvObj = (IEnumVARIANT*)this; 44 | 45 | if(*ppvObj) 46 | { 47 | AddRef(); 48 | return S_OK; 49 | } 50 | 51 | return E_NOTIMPL; 52 | } 53 | 54 | STDMETHODIMP CBoxDictEnum::Next(ULONG celt, VARIANT *rgVar, ULONG *pCeltFetched) 55 | { 56 | ULONG l; 57 | 58 | if(pCeltFetched != NULL) 59 | *pCeltFetched = 0; 60 | else if(celt > 1) 61 | return ResultFromScode( E_INVALIDARG ) ; 62 | 63 | for(l=0; l < celt; l++) 64 | VariantInit( &rgVar[l] ); 65 | 66 | long nCount = m_pDict->get_Count(); 67 | 68 | for(l = 0; m_nPos < nCount && celt != 0; l ++, m_nPos ++) 69 | { 70 | celt-- ; 71 | rgVar[l].vt = VT_BSTR; 72 | rgVar[l].bstrVal = m_pDict->get_Key(m_nPos); 73 | if(pCeltFetched != NULL)(*pCeltFetched)++; 74 | } 75 | 76 | if(celt != 0) 77 | return ResultFromScode(S_FALSE); 78 | 79 | return S_OK; 80 | } 81 | 82 | STDMETHODIMP CBoxDictEnum::Skip(ULONG celt) 83 | { 84 | long nCount = m_pDict->get_Count(); 85 | m_nPos += celt; 86 | if(m_nPos > nCount) 87 | m_nPos = nCount; 88 | return S_OK; 89 | } 90 | 91 | STDMETHODIMP CBoxDictEnum::Reset(void) 92 | { 93 | m_nPos = 0; 94 | return S_OK; 95 | } 96 | 97 | STDMETHODIMP CBoxDictEnum::Clone(IEnumVARIANT **ppEnum) 98 | { 99 | *ppEnum = new CBoxDictEnum(this); 100 | return S_OK; 101 | } 102 | -------------------------------------------------------------------------------- /NetBox2/BoxDictEnum.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BoxDictionary.h" 4 | #include "BoxObject.h" 5 | 6 | #pragma warning(disable : 4584) 7 | class CBoxDictEnum : 8 | public IUnknown, 9 | public IEnumVARIANT 10 | { 11 | public: 12 | CBoxDictEnum(CBoxDictionary* pDict); 13 | CBoxDictEnum(CBoxDictEnum* pEnum); 14 | 15 | ~CBoxDictEnum(void); 16 | 17 | public: 18 | // IUnknown 19 | STDMETHOD_(ULONG, AddRef)(); 20 | STDMETHOD_(ULONG, Release)(); 21 | STDMETHOD(QueryInterface)(REFIID iid, LPVOID* ppvObj); 22 | 23 | public: 24 | // IEnumVARIANT 25 | STDMETHOD(Next)(ULONG celt, VARIANT *rgVar, ULONG *pCeltFetched); 26 | STDMETHOD(Skip)(ULONG celt); 27 | STDMETHOD(Reset)(void); 28 | STDMETHOD(Clone)(IEnumVARIANT **ppEnum); 29 | 30 | private: 31 | long m_dwRef; 32 | int m_nPos; 33 | CBoxObject m_pDict; 34 | }; 35 | #pragma warning(default : 4584) 36 | -------------------------------------------------------------------------------- /NetBox2/BoxDictionary.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | // CBoxDictionary command target 7 | 8 | class CBoxDictionary : public CBoxSafeObject 9 | { 10 | DECLARE_DYNCREATE(CBoxDictionary) 11 | protected: 12 | class CAssoc 13 | { 14 | friend class CBoxDictionary; 15 | const CString key; 16 | CComVariant value; 17 | CAssoc* pNext; 18 | UINT nHashValue; // needed for efficient iteration 19 | public: 20 | CAssoc( LPCTSTR keyval ) : key( keyval ) {} 21 | }; 22 | 23 | public: 24 | // Construction 25 | CBoxDictionary(INT_PTR nBlockSize = 10); 26 | ~CBoxDictionary(); 27 | 28 | template 29 | void SetDefaultValue(const TYPE value) 30 | { 31 | CSingleLock l(&m_cs, TRUE); 32 | m_varDefault = value; 33 | } 34 | template 35 | void SetValue(LPCTSTR pstrKey, const TYPE value) 36 | { 37 | CSingleLock l(&m_cs, TRUE); 38 | Lookup(pstrKey) = value; 39 | } 40 | 41 | virtual void GetDefaultValue(CComVariant& rValue); 42 | 43 | BOOL GetValue(LPCTSTR key, CComVariant& rValue); 44 | BOOL GetValue(long index, CComVariant& rValue); 45 | BOOL GetKey(long index, CString& rKey); 46 | BOOL GetAssoc(long index, CString& rKey, CComVariant& rValue); 47 | 48 | void SetReadOnly(BOOL bReadOnly = TRUE); 49 | void SetAutoAdd(BOOL bAutoAdd = TRUE); 50 | 51 | BOOL Remove(LPCTSTR key); 52 | void RemoveAll(); 53 | 54 | virtual void InitNewValue(CComVariant& var); 55 | 56 | protected: 57 | CAssoc** m_pHashTable; 58 | UINT m_nHashTableSize; 59 | INT_PTR m_nCount; 60 | CAssoc* m_pFreeList; 61 | struct CPlex* m_pBlocks; 62 | INT_PTR m_nBlockSize; 63 | 64 | CCriticalSection m_cs; 65 | BOOL m_bReadOnly; 66 | BOOL m_bAutoAdd; 67 | CPtrArray m_pAssocArray; 68 | 69 | CAssoc* NewAssoc(LPCTSTR key); 70 | void FreeAssoc(CAssoc*); 71 | CAssoc* GetAssocAt(LPCTSTR, UINT&, UINT&) const; 72 | 73 | UINT HashKey(LPCTSTR key) const; 74 | 75 | CComVariant& Lookup(LPCTSTR key); 76 | CAssoc* Lookup(VARIANT &varKey); 77 | 78 | UINT GetHashTableSize() const; 79 | void InitHashTable(UINT hashSize, BOOL bAllocNow = TRUE); 80 | 81 | CComVariant m_varDefault; 82 | 83 | public: 84 | afx_msg long get_Count(void); 85 | afx_msg BSTR get_Key(long index); 86 | afx_msg VARIANT get_Item(VARIANT& varKey); 87 | afx_msg void put_Item(VARIANT& varKey, VARIANT& var); 88 | afx_msg LPUNKNOWN get__NewEnum(void); 89 | 90 | afx_msg BOOL Exists(LPCTSTR pstrKey); 91 | afx_msg void RemoveDISP(LPCTSTR pstrKey); 92 | afx_msg void RemoveAllDISP(void); 93 | 94 | DECLARE_DISPATCH_MAP() 95 | }; 96 | -------------------------------------------------------------------------------- /NetBox2/BoxEncoding.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | #include 6 | 7 | // CBoxEncoding command target 8 | 9 | class CBoxEncoding : public CBoxSafeObject 10 | { 11 | DECLARE_DYNAMIC(CBoxEncoding) 12 | 13 | public: 14 | afx_msg BSTR HtmlEncode(LPCTSTR pstrText); 15 | afx_msg BSTR HtmlDecode(LPCTSTR pstrText); 16 | 17 | afx_msg BSTR UrlEncode(LPCTSTR pstrText); 18 | afx_msg BSTR UrlDecode(LPCTSTR pstrText); 19 | 20 | afx_msg BSTR JSEncode(LPCTSTR pstrText); 21 | afx_msg BSTR JSDecode(LPCTSTR pstrText); 22 | 23 | afx_msg VARIANT StrToBin(VARIANT& var, VARIANT &varCP); 24 | afx_msg BSTR BinToStr(VARIANT& var, VARIANT &varCP); 25 | 26 | afx_msg VARIANT Base64Decode(LPCTSTR pstrText); 27 | afx_msg BSTR Base64Encode(VARIANT& var); 28 | 29 | afx_msg VARIANT HexDecode(LPCTSTR pstrText); 30 | afx_msg BSTR HexEncode(VARIANT& var); 31 | 32 | DECLARE_DISPATCH_MAP() 33 | 34 | private: 35 | enum FMTLEVEL 36 | { 37 | FL_STYLE = 1, 38 | FL_FORM = 2, 39 | FL_FRAME = 4, 40 | FL_IMAGE = 8, 41 | FL_SCRIPT = 16 42 | }; 43 | }; 44 | 45 | 46 | -------------------------------------------------------------------------------- /NetBox2/BoxFactory.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "NetBox2.h" 3 | #include "BoxObject.h" 4 | #include "atlbase.h" 5 | #include "BoxFactory.h" 6 | #include "BoxScriptObject.h" 7 | 8 | 9 | STDMETHODIMP CBoxFactory::CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void** ppvObj) 10 | { 11 | if(ppvObj == NULL) 12 | return E_POINTER; 13 | 14 | if(pUnkOuter != NULL) 15 | return CLASS_E_NOAGGREGATION; 16 | 17 | if(m_pClass != NULL) 18 | { 19 | CCmdTarget* pObject = (CCmdTarget*)m_pClass->CreateObject(); 20 | 21 | if(pObject != NULL) 22 | { 23 | *ppvObj = pObject->GetIDispatch(FALSE); 24 | return S_OK; 25 | } 26 | return CO_E_CLASSSTRING; 27 | } 28 | 29 | if(!m_strScriptName.IsEmpty()) 30 | { 31 | static VARIANT varFalse; 32 | try 33 | { 34 | *ppvObj = theApp.m_pSystem->LoadObject(m_strScriptName, varFalse); 35 | }catch(CException* e) 36 | { 37 | e->Delete(); 38 | 39 | return CO_E_CLASSSTRING; 40 | } 41 | 42 | return S_OK; 43 | } 44 | 45 | if(m_pDisp != NULL) 46 | return m_pDisp->QueryInterface(IID_IDispatch, ppvObj); 47 | 48 | return CO_E_CLASSSTRING; 49 | } 50 | 51 | STDMETHODIMP CBoxStruct::GetTypeInfoCount(UINT *pctinfo) 52 | { 53 | return E_NOTIMPL; 54 | } 55 | 56 | STDMETHODIMP CBoxStruct::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) 57 | { 58 | return E_NOTIMPL; 59 | } 60 | 61 | STDMETHODIMP CBoxStruct::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) 62 | { 63 | return E_NOTIMPL; 64 | } 65 | 66 | STDMETHODIMP CBoxStruct::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) 67 | { 68 | return E_NOTIMPL; 69 | } 70 | 71 | STDMETHODIMP CBoxStruct::GetInterfaceSafetyOptions(REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions) 72 | { 73 | if (!s_bObjectSafety) 74 | return E_NOINTERFACE; 75 | 76 | if (pdwSupportedOptions == NULL || pdwEnabledOptions == NULL) 77 | return E_POINTER; 78 | 79 | *pdwSupportedOptions = 3; 80 | *pdwEnabledOptions = 1; 81 | 82 | return S_OK; 83 | } 84 | 85 | STDMETHODIMP CBoxStruct::SetInterfaceSafetyOptions(REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions) 86 | { 87 | if (!s_bObjectSafety) 88 | return E_NOINTERFACE; 89 | 90 | return S_OK; 91 | } 92 | -------------------------------------------------------------------------------- /NetBox2/BoxFile.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define BOX_FOLDER (CFile*)-1 4 | 5 | class CBoxFile 6 | { 7 | public: 8 | CBoxFile(); 9 | virtual ~CBoxFile(); 10 | 11 | public: 12 | static CString m_strBasePath; 13 | static CString m_strAppName; 14 | static CString m_strExeName; 15 | static CString m_strStartup; 16 | 17 | public: 18 | void SetRuntimeFile(LPCTSTR pstrFile); 19 | 20 | public: 21 | virtual CFile* Open(LPCTSTR pstrName); 22 | virtual SYSTEMTIME GetFileTime(CFile* pFile); 23 | virtual void GetFileTimeString(CFile* pFile, CString& strTime); 24 | }; 25 | 26 | extern CBoxFile* g_pFile; 27 | 28 | class CBoxSafeFile : public CFile 29 | { 30 | public: 31 | virtual ULONGLONG Seek(LONGLONG lOff, UINT nFrom) 32 | { 33 | try 34 | { 35 | return CFile::Seek(lOff, nFrom); 36 | }catch(CException* e) 37 | { 38 | e->Delete(); 39 | } 40 | 41 | return 0; 42 | } 43 | 44 | virtual ULONGLONG GetLength() const 45 | { 46 | try 47 | { 48 | return CFile::GetLength(); 49 | }catch(CException* e) 50 | { 51 | e->Delete(); 52 | } 53 | 54 | return 0; 55 | } 56 | 57 | virtual UINT Read(void* lpBuf, UINT nCount) 58 | { 59 | try 60 | { 61 | return CFile::Read(lpBuf, nCount); 62 | }catch(CException* e) 63 | { 64 | e->Delete(); 65 | } 66 | 67 | return 0; 68 | } 69 | 70 | virtual void Write(const void* lpBuf, UINT nCount) 71 | { 72 | try 73 | { 74 | CFile::Write(lpBuf, nCount); 75 | }catch(CException* e) 76 | { 77 | e->Delete(); 78 | } 79 | } 80 | 81 | virtual void Close() 82 | { 83 | try 84 | { 85 | CFile::Close(); 86 | }catch(CException* e) 87 | { 88 | e->Delete(); 89 | } 90 | } 91 | }; 92 | 93 | -------------------------------------------------------------------------------- /NetBox2/BoxHttpContext.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "BoxHttpAccept.h" 5 | #include "BoxHttpRequest.h" 6 | #include "BoxHttpResponse.h" 7 | 8 | // CBoxHttpContext command target 9 | 10 | class CBoxHttpContext : public CBoxSafeObject 11 | { 12 | DECLARE_DYNAMIC(CBoxHttpContext) 13 | 14 | public: 15 | CBoxHttpContext(void) 16 | { 17 | m_pRequest.CreateInstance(); 18 | m_pResponse.CreateInstance(); 19 | } 20 | 21 | void Bind(CBoxHttpAccept* pAccept, CBoxScript* pScript); 22 | 23 | public: 24 | afx_msg void put_ScriptTimeout(long tm); 25 | afx_msg long get_ScriptTimeout(void); 26 | 27 | afx_msg LPDISPATCH CreateObject(LPCTSTR pstrClass); 28 | afx_msg void Execute(LPCTSTR pstrPath); 29 | afx_msg LPDISPATCH GetLastErrorDISP(void); 30 | afx_msg BSTR MapPath(LPCTSTR pstrPath); 31 | afx_msg void Transfer(LPCTSTR pstrPath); 32 | 33 | afx_msg BSTR HtmlEncode(LPCTSTR pstrText); 34 | afx_msg BSTR UrlEncode(LPCTSTR pstrText); 35 | 36 | DECLARE_DISPATCH_MAP() 37 | 38 | public: 39 | CBoxObject m_pAccept; 40 | CBoxObject m_pRequest; 41 | CBoxObject m_pResponse; 42 | 43 | CString m_strBasePath; 44 | }; 45 | -------------------------------------------------------------------------------- /NetBox2/BoxHttpCookies.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "BoxObject.h" 3 | #include "BoxHttpCookies.h" 4 | #include "BoxHttpCookiesItem.h" 5 | 6 | #ifdef _DEBUG 7 | #define new DEBUG_NEW 8 | #endif 9 | 10 | 11 | CBoxHttpCookies::CBoxHttpCookies(void) 12 | { 13 | SetAutoAdd(); 14 | } 15 | 16 | void CBoxHttpCookies::InitNewValue(CComVariant& var) 17 | { 18 | CBoxObject pItem; 19 | 20 | pItem.CreateInstance(); 21 | var = (LPDISPATCH)pItem; 22 | } 23 | 24 | BEGIN_DISPATCH_MAP(CBoxHttpCookies, CBoxDictionary) 25 | DISP_PROPERTY_PARAM_ID(CBoxHttpCookies, "Item", 0, get_Item, put_Item, VT_VARIANT, VTS_VARIANT) 26 | END_DISPATCH_MAP() 27 | 28 | void CBoxHttpCookies::put_Item(VARIANT& varKey, VARIANT& var) 29 | { 30 | CBoxObject pItem; 31 | VARIANT varItem; 32 | 33 | varItem = get_Item(varKey); 34 | pItem = varItem.pdispVal; 35 | VariantClear(&varItem); 36 | if(pItem != NULL) 37 | { 38 | pItem->RemoveAll(); 39 | pItem->SetDefaultValue(var); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /NetBox2/BoxHttpCookies.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "BoxDictionary.h" 3 | 4 | class CBoxHttpCookies : public CBoxDictionary 5 | { 6 | public: 7 | CBoxHttpCookies(void); 8 | 9 | public: 10 | virtual void InitNewValue(CComVariant& var); 11 | 12 | public: 13 | afx_msg void put_Item(VARIANT& varKey, VARIANT& var); 14 | 15 | DECLARE_DISPATCH_MAP() 16 | }; 17 | -------------------------------------------------------------------------------- /NetBox2/BoxHttpRequest.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "BoxStream.h" 5 | #include "BoxHttpAccept.h" 6 | #include 7 | 8 | // CBoxHttpRequest command target 9 | 10 | class CBoxHttpRequest : public CBoxStream 11 | { 12 | DECLARE_DYNAMIC(CBoxHttpRequest) 13 | public: 14 | void Bind(CBoxHttpAccept* pAccept) 15 | { 16 | m_pAccept = pAccept; 17 | } 18 | 19 | public: 20 | virtual HRESULT StreamRead(void *pv, ULONG cb, ULONG *pcbRead); 21 | 22 | public: 23 | afx_msg LPDISPATCH get_ClientCertificate(void); 24 | afx_msg LPDISPATCH get_Cookies(void); 25 | afx_msg LPDISPATCH get_Form(void); 26 | afx_msg LPDISPATCH get_QueryString(void); 27 | afx_msg LPDISPATCH get_ServerVariables(void); 28 | afx_msg LPDISPATCH get_Browser(void); 29 | 30 | afx_msg long get_TotalBytes(void); 31 | afx_msg BSTR get_ContentType(void); 32 | afx_msg VARIANT BinaryRead(long count); 33 | 34 | afx_msg VARIANT get_Item(VARIANT& varName); 35 | 36 | DECLARE_DISPATCH_MAP() 37 | 38 | private: 39 | void CheckClientCertificate(void); 40 | void CheckCookies(void); 41 | void CheckForm(void); 42 | void CheckQueryString(void); 43 | void CheckServerVariables(void); 44 | 45 | private: 46 | CBoxObject m_pAccept; 47 | 48 | CBComPtr m_pClientCertificate; 49 | CBComPtr m_pCookies; 50 | CBComPtr m_pForm; 51 | CBComPtr m_pQueryString; 52 | CBComPtr m_pServerVariables; 53 | CBComPtr m_pBrowserCaps; 54 | }; 55 | -------------------------------------------------------------------------------- /NetBox2/BoxHttpResponse.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "BoxStream.h" 5 | #include "BoxHttpAccept.h" 6 | #include "BoxScript.h" 7 | 8 | // CBoxHttpResponse command target 9 | 10 | class CBoxHttpResponse : public CBoxStream 11 | { 12 | DECLARE_DYNAMIC(CBoxHttpResponse) 13 | public: 14 | CBoxHttpResponse(void) : 15 | m_bEnd(FALSE) 16 | {} 17 | 18 | void Bind(CBoxHttpAccept* pAccept, CBoxScript* pScript) 19 | { 20 | m_pAccept = pAccept; 21 | m_pScript = pScript; 22 | } 23 | 24 | virtual HRESULT StreamWrite(const void *pv, ULONG cb, ULONG *pcbWritten); 25 | 26 | CBoxScript* m_pScript; 27 | BOOL m_bEnd; 28 | 29 | public: 30 | afx_msg LPDISPATCH get_Cookies(void); 31 | 32 | afx_msg BOOL get_Buffer(void); 33 | afx_msg void put_Buffer(BOOL bBuffer); 34 | 35 | afx_msg void put_CacheControl(LPCTSTR pstrCacheControl); 36 | afx_msg void put_ContentType(LPCTSTR pstrContentType); 37 | afx_msg void put_ContentEncoding(LPCTSTR pstrContentEncoding); 38 | afx_msg void put_Expires(long nTime); 39 | afx_msg void put_ExpiresAbsolute(DATE dateExpires); 40 | afx_msg void put_Status(LPCTSTR pstrStatus); 41 | 42 | afx_msg void AddHeader(LPCTSTR pstrName, LPCTSTR pstrValue); 43 | afx_msg void AppendToLog(LPCTSTR pstrLog); 44 | afx_msg void BinaryWrite(VARIANT& var); 45 | afx_msg void Clear(void); 46 | afx_msg void End(void); 47 | afx_msg void Flush(void); 48 | afx_msg void PICS(LPCTSTR pstrPICSLabel); 49 | afx_msg void Redirect(LPCTSTR pstrUrl); 50 | afx_msg void MapToFile(LPCTSTR pstrFile); 51 | afx_msg void Write(VARIANT& var); 52 | afx_msg void WriteBlock(long id); 53 | 54 | afx_msg BOOL IsClientConnected(void); 55 | 56 | afx_msg LPDISPATCH get_Socket(void); 57 | 58 | DECLARE_DISPATCH_MAP() 59 | 60 | private: 61 | CBoxObject m_pAccept; 62 | CBComPtr m_pCookies; 63 | }; 64 | -------------------------------------------------------------------------------- /NetBox2/BoxHttpScript.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NetBox2/BoxHttpScript.cpp -------------------------------------------------------------------------------- /NetBox2/BoxHttpScript.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "BoxScript.h" 3 | 4 | class CBoxHttpScript : public CBoxScript 5 | { 6 | DECLARE_DYNCREATE(CBoxHttpScript) 7 | public: 8 | CBoxHttpScript(void) 9 | {} 10 | 11 | void SetBasePath(LPCTSTR pstrPath) 12 | { 13 | m_strHttpBasePath = pstrPath; 14 | } 15 | 16 | BOOL GetSessionState(void) 17 | { 18 | return m_pHost->m_arrayExtData[0]; 19 | } 20 | 21 | void SetSessionState(BOOL bSessionState) 22 | { 23 | m_bSessionState = bSessionState; 24 | } 25 | 26 | protected: 27 | virtual void InitScript(void); 28 | virtual int ParseScriptText(LPCSTR pstrText, int nCount, CStringA& strScriptText, int nIncludeFlagIndex); 29 | 30 | int AddBlock(LPCSTR pBuf, int nSize) 31 | { 32 | char* pBuffer = new char[nSize + sizeof(int)]; 33 | 34 | if(pBuffer != NULL) 35 | { 36 | *(int*)pBuffer = nSize; 37 | memcpy(pBuffer + sizeof(int), pBuf, nSize); 38 | return (int)m_pHost->m_arrayBlock.Add(pBuffer); 39 | } 40 | 41 | return -1; 42 | } 43 | 44 | UINT ParseScriptTextCodePage(LPCSTR pstrText, int nCount); 45 | 46 | private: 47 | CString m_strHttpBasePath; 48 | BOOL m_bSessionState; 49 | }; 50 | -------------------------------------------------------------------------------- /NetBox2/BoxHttpServer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "BoxTcpServer.h" 3 | #include "BoxDictionary.h" 4 | 5 | class CBoxHttpServer : public CBoxTcpServer 6 | { 7 | DECLARE_DYNCREATE(CBoxHttpServer) 8 | public: 9 | CBoxHttpServer(void); 10 | virtual ~CBoxHttpServer(void); 11 | 12 | virtual void OnSleepTimer(__int64 nNowTime); 13 | virtual CBoxJobWorker* CreateNewWorker(void); 14 | 15 | void SendFile(CBoxSocket* pSocket, CFile* pFile, ULONGLONG ullStart, ULONGLONG ullLen, long retVal); 16 | 17 | public: 18 | afx_msg long Create(LPCTSTR pstrSocketAddress, UINT nSocketPort); 19 | afx_msg LPDISPATCH AddHost(LPCTSTR pstrName, LPCTSTR pstrRoot); 20 | afx_msg void AttachHost(LPCTSTR pstrName, LPDISPATCH pdispHost); 21 | afx_msg void Start(void); 22 | afx_msg void Close(void); 23 | afx_msg long get_DownloadWorkers(void); 24 | afx_msg long get_totalBytes(void); 25 | 26 | DECLARE_DISPATCH_MAP() 27 | 28 | public: 29 | long m_nDownloadWorkers; 30 | long m_ntotalBytes; 31 | long m_nMaxRequestEntity; 32 | 33 | private: 34 | __int64 m_nLastCheckTime; 35 | 36 | private: 37 | class CSendFile : public OVERLAPPED 38 | { 39 | public: 40 | CSendFile():buf(NULL), sizeofbuf(0) 41 | {} 42 | ~CSendFile(void) 43 | { 44 | if (buf) delete buf; 45 | InterlockedDecrement(&((CBoxHttpServer*)m_pSocket->m_pContext)->m_nDownloadWorkers); 46 | delete m_pFile; 47 | } 48 | 49 | CBoxObject m_pSocket; 50 | CFile *m_pFile; 51 | ULONGLONG m_ullStart; 52 | ULONGLONG m_ullLen; 53 | long m_retVal; 54 | 55 | char *m_pBuf; 56 | char *buf; 57 | DWORD sizeofbuf; 58 | long m_nSize; 59 | long m_nPos; 60 | }; 61 | 62 | static void CALLBACK SendFile(ULONG_PTR dwParam); 63 | static VOID CALLBACK IoCompletionRoutine(DWORD dwErrorCode, DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped); 64 | 65 | static UINT staticSendThread(void* p); 66 | void SendThread(); 67 | static void CALLBACK StopSendThread(ULONG_PTR dwParam); 68 | 69 | CWinThread *m_pSendThread; 70 | }; 71 | -------------------------------------------------------------------------------- /NetBox2/BoxHttpSession.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "BoxLRUCache.h" 5 | #include "BoxHttpHost.h" 6 | #include 7 | 8 | class CBoxHttpContext; 9 | class CBoxHttpHost; 10 | 11 | // CBoxHttpSession command target 12 | 13 | class CBoxHttpSession : public CBoxSafeObject, 14 | public CBoxLRUCacheNode 15 | { 16 | DECLARE_DYNAMIC(CBoxHttpSession) 17 | public: 18 | CBoxHttpSession() 19 | { 20 | m_pContents.CreateInstance(); 21 | m_pContents->put_ArrayMode(0); 22 | } 23 | 24 | public: 25 | __int64 m_tmLastTime; 26 | long m_nTimeout; 27 | CBoxHttpHost *m_pHost; 28 | CString m_strKey; 29 | 30 | public: 31 | afx_msg VARIANT get_Item(VARIANT& varKey); 32 | afx_msg void put_Item(VARIANT& varKey, VARIANT& var); 33 | afx_msg LPDISPATCH get_Contents(void); 34 | 35 | afx_msg LPUNKNOWN get__NewEnum(void); 36 | 37 | afx_msg long get_SessionID(void); 38 | afx_msg BSTR get_SessionKey(void); 39 | afx_msg DATE get_LastAccessTime(void); 40 | afx_msg LPDISPATCH get_StaticObjects(void); 41 | 42 | afx_msg long get_Timeout(void); 43 | afx_msg void put_Timeout(long tm); 44 | 45 | afx_msg void Reset(void); 46 | afx_msg void Abandon(void); 47 | 48 | DECLARE_DISPATCH_MAP() 49 | 50 | public: 51 | CBComPtr m_pContents; 52 | }; 53 | -------------------------------------------------------------------------------- /NetBox2/BoxLRUCache.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "BoxLink.h" 5 | #include "BoxObject.h" 6 | 7 | class CBoxLRUCacheNode : public CBoxLinkNode 8 | { 9 | public: 10 | CString m_strNodeKey; 11 | }; 12 | 13 | template 14 | class CBoxLRUCache 15 | { 16 | public: 17 | CBoxLRUCache(void) 18 | { 19 | m_mapNode.InitHashTable(3049); 20 | } 21 | 22 | BOOL IsEmpty(void) 23 | { 24 | return m_link.IsEmpty(); 25 | } 26 | 27 | void Update(T* pItem) 28 | { 29 | m_link.Remove(pItem); 30 | m_link.AddHead(pItem); 31 | } 32 | 33 | BOOL Exists(LPCTSTR pstrKey) 34 | { 35 | if(m_link.IsEmpty()) 36 | return FALSE; 37 | 38 | CString strTemp(pstrKey); 39 | 40 | strTemp.MakeLower(); 41 | 42 | return m_mapNode.PLookup(strTemp) != NULL; 43 | } 44 | 45 | BOOL Lookup(LPCTSTR pstrKey, CBoxObject& pItem) 46 | { 47 | if(m_link.IsEmpty()) 48 | return FALSE; 49 | 50 | CString strTemp(pstrKey); 51 | 52 | strTemp.MakeLower(); 53 | 54 | if(m_mapNode.Lookup(strTemp, pItem)) 55 | { 56 | Update(pItem); 57 | 58 | return TRUE; 59 | } 60 | 61 | return FALSE; 62 | } 63 | 64 | T* GetLast(void) 65 | { 66 | return m_link.GetTail(); 67 | } 68 | 69 | void Remove(T* pItem) 70 | { 71 | if(!pItem->m_strNodeKey.IsEmpty()) 72 | { 73 | if(m_mapNode.RemoveKey(pItem->m_strNodeKey)) 74 | m_link.Remove(pItem); 75 | pItem->m_strNodeKey.Empty(); 76 | } 77 | } 78 | 79 | void Add(LPCTSTR pstrKey, T* pItem) 80 | { 81 | CString strTemp(pstrKey); 82 | 83 | strTemp.MakeLower(); 84 | 85 | CBoxObject &p = m_mapNode[strTemp]; 86 | 87 | if(p != NULL) 88 | m_link.Remove(p); 89 | 90 | pItem->m_strNodeKey = strTemp; 91 | p = pItem; 92 | m_link.AddHead(pItem); 93 | } 94 | 95 | void RemoveAll(void) 96 | { 97 | m_link.RemoveAll(); 98 | m_mapNode.RemoveAll(); 99 | } 100 | 101 | private: 102 | CMap, T*> m_mapNode; 103 | CBoxLink m_link; 104 | }; 105 | -------------------------------------------------------------------------------- /NetBox2/BoxMemFile.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "afx.h" 3 | 4 | class CBoxMemFile : public CMemFile 5 | { 6 | public: 7 | virtual void GrowFile(SIZE_T dwNewLen) 8 | { 9 | m_nGrowBytes = m_nBufferSize / 5; 10 | if(m_nGrowBytes < 1024)m_nGrowBytes = 1024; 11 | 12 | CMemFile::GrowFile(dwNewLen); 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /NetBox2/BoxPath.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CBoxPath 4 | { 5 | public: 6 | CBoxPath(void) 7 | { 8 | m_strPath = new TCHAR[MAX_PATH]; 9 | m_strPath[0] = 0; 10 | } 11 | 12 | ~CBoxPath(void) 13 | { 14 | delete m_strPath; 15 | } 16 | 17 | void Combine(LPCTSTR pstrBasePath, LPCTSTR pstrFile = NULL) 18 | { 19 | int nCount = 0; 20 | 21 | while(pstrBasePath != NULL || pstrFile != NULL) 22 | { 23 | if(pstrBasePath == NULL) 24 | { 25 | pstrBasePath = pstrFile; 26 | pstrFile = NULL; 27 | } 28 | 29 | while(*pstrBasePath && nCount < MAX_PATH - 1) 30 | { 31 | while(*pstrBasePath && 32 | (*pstrBasePath == _T('\\') || *pstrBasePath == _T('/') || 33 | (*pstrBasePath == _T('.') && (pstrBasePath[1] == _T('\\') || pstrBasePath[1] == _T('/'))))) 34 | pstrBasePath ++; 35 | 36 | if(*pstrBasePath == _T('.') && pstrBasePath[1] == _T('.') && 37 | (pstrBasePath[2] == _T('\\') || pstrBasePath[2] == _T('/'))) 38 | { 39 | while(nCount > 0 && m_strPath[nCount - 1] != _T('\\')) 40 | nCount --; 41 | pstrBasePath += 3; 42 | if(nCount > 0) 43 | nCount --; 44 | continue; 45 | } 46 | 47 | if(*pstrBasePath) 48 | { 49 | m_strPath[nCount ++] = _T('\\'); 50 | while(nCount < MAX_PATH - 1 && *pstrBasePath && 51 | *pstrBasePath != _T('\\') && *pstrBasePath != _T('/')) 52 | m_strPath[nCount ++] = *pstrBasePath ++; 53 | }else if(pstrFile == NULL) 54 | m_strPath[nCount ++] = _T('\\'); 55 | } 56 | 57 | pstrBasePath = pstrFile; 58 | pstrFile = NULL; 59 | } 60 | 61 | m_strPath[nCount] = 0; 62 | } 63 | 64 | void toLower(void) 65 | { 66 | _tcslwr(m_strPath); 67 | } 68 | 69 | LPTSTR m_strPath; 70 | }; 71 | -------------------------------------------------------------------------------- /NetBox2/BoxPipe.cpp: -------------------------------------------------------------------------------- 1 | // BoxPipe.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "BoxPipe.h" 6 | 7 | 8 | // CBoxPipe 9 | 10 | IMPLEMENT_DYNCREATE(CBoxPipe, CBoxStream) 11 | 12 | CBoxPipe::CBoxPipe() 13 | { 14 | } 15 | 16 | CBoxPipe::~CBoxPipe() 17 | { 18 | } 19 | 20 | BEGIN_DISPATCH_MAP(CBoxPipe, CBoxStream) 21 | END_DISPATCH_MAP() 22 | 23 | 24 | // CBoxPipe message handlers 25 | 26 | -------------------------------------------------------------------------------- /NetBox2/BoxPipe.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "BoxStream.h" 5 | #include 6 | 7 | // CBoxPipe command target 8 | 9 | class CBoxPipe : public CBoxStream 10 | { 11 | DECLARE_DYNCREATE(CBoxPipe) 12 | 13 | public: 14 | CBoxPipe(); 15 | virtual ~CBoxPipe(); 16 | 17 | public: 18 | DECLARE_DISPATCH_MAP() 19 | 20 | private: 21 | class CPipeNode 22 | { 23 | public: 24 | int m_nSize; 25 | char m_buf[1024]; 26 | }; 27 | 28 | int m_nPos; 29 | CList m_listBuffers; 30 | HANDLE m_hLockRead; 31 | HANDLE m_hLockWrite; 32 | CCriticalSection m_csBuffer; 33 | CCriticalSection m_csLockRead; 34 | }; 35 | 36 | -------------------------------------------------------------------------------- /NetBox2/BoxProtocol.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "urlmon.h" 3 | #include 4 | 5 | class CBoxProtocol : public CBClass, 6 | public IInternetProtocolInfo 7 | { 8 | INTERFACE_BEGIN_EX(CBClass) 9 | INTERFACE_DEF_IID(IID_IInternetProtocolRoot, IInternetProtocol) 10 | INTERFACE_DEF(IInternetProtocolInfo) 11 | INTERFACE_END 12 | 13 | public: 14 | CBoxProtocol(void) : m_pFile(NULL) 15 | {} 16 | 17 | ~CBoxProtocol(void) 18 | { 19 | Clear(); 20 | } 21 | 22 | public: 23 | STDMETHOD(Start)(LPCWSTR szUrl, IInternetProtocolSink *pIProtSink, 24 | IInternetBindInfo *pIBindInfo, DWORD grfSTI, DWORD dwReserved); 25 | STDMETHOD(Continue)(PROTOCOLDATA *pStateInfo); 26 | STDMETHOD(Abort)(HRESULT hrReason,DWORD dwOptions); 27 | STDMETHOD(Terminate)(DWORD dwOptions); 28 | STDMETHOD(Suspend)(); 29 | STDMETHOD(Resume)(); 30 | STDMETHOD(Read)(void *pv,ULONG cb,ULONG *pcbRead); 31 | STDMETHOD(Seek)(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition); 32 | STDMETHOD(LockRequest)(DWORD dwOptions); 33 | STDMETHOD(UnlockRequest)(); 34 | 35 | public: 36 | STDMETHOD(ParseUrl)(LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved); 37 | STDMETHOD(CombineUrl)(LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved); 38 | STDMETHOD(CompareUrl)(LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags); 39 | STDMETHOD(QueryInfo)(LPCWSTR pwzUrl, QUERYOPTION QueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved); 40 | 41 | private: 42 | void Clear(); 43 | 44 | CFile* m_pFile; 45 | CComPtr m_pProtSink; 46 | }; 47 | -------------------------------------------------------------------------------- /NetBox2/BoxRSA.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | // CBoxRSA command target 7 | 8 | class CBoxRSA : public CBoxSafeObject 9 | { 10 | DECLARE_DYNCREATE(CBoxRSA) 11 | public: 12 | CBoxRSA(void) : 13 | m_pRSA(NULL), 14 | m_nPadding(1) 15 | {} 16 | 17 | ~CBoxRSA(void) 18 | { 19 | free(); 20 | } 21 | 22 | private: 23 | void free(void) 24 | { 25 | if(m_pRSA != NULL) 26 | RSA_free(m_pRSA); 27 | } 28 | 29 | public: 30 | afx_msg void GenerateKey(VARIANT &var); 31 | afx_msg long get_KeySize(void); 32 | 33 | afx_msg BOOL get_IsPrivateKey(void); 34 | afx_msg VARIANT get_PrivateKey(void); 35 | afx_msg void put_PrivateKey(VARIANT &var); 36 | 37 | afx_msg VARIANT get_PublicKey(void); 38 | afx_msg void put_PublicKey(VARIANT &var); 39 | 40 | afx_msg VARIANT get_Key(void); 41 | 42 | afx_msg VARIANT Encrypt(VARIANT& var); 43 | afx_msg VARIANT Decrypt(VARIANT& var); 44 | 45 | DECLARE_DISPATCH_MAP() 46 | 47 | private: 48 | RSA *m_pRSA; 49 | long m_nPadding; 50 | }; 51 | 52 | 53 | -------------------------------------------------------------------------------- /NetBox2/BoxSafeObject.cpp: -------------------------------------------------------------------------------- 1 | // BoxSafeObject.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | 6 | 7 | // CBoxSafeObject 8 | 9 | IMPLEMENT_DYNAMIC(CBoxSafeObject, CCmdTarget) 10 | 11 | BEGIN_INTERFACE_MAP(CBoxSafeObject, CCmdTarget) 12 | INTERFACE_PART(CBoxSafeObject, IID_IObjectSafety, ObjectSafety) 13 | END_INTERFACE_MAP() 14 | 15 | // CBoxSafeObject message handlers 16 | 17 | STDMETHODIMP_(ULONG) CBoxSafeObject::XObjectSafety::AddRef() 18 | { 19 | METHOD_PROLOGUE_EX_(CBoxSafeObject, ObjectSafety) 20 | return pThis->ExternalAddRef(); 21 | } 22 | 23 | STDMETHODIMP_(ULONG) CBoxSafeObject::XObjectSafety::Release() 24 | { 25 | METHOD_PROLOGUE_EX_(CBoxSafeObject, ObjectSafety) 26 | return pThis->ExternalRelease(); 27 | } 28 | 29 | STDMETHODIMP CBoxSafeObject::XObjectSafety::QueryInterface(REFIID iid, LPVOID far* ppvObj) 30 | { 31 | METHOD_PROLOGUE_EX_(CBoxSafeObject, ObjectSafety) 32 | 33 | return pThis->ExternalQueryInterface(&iid, ppvObj); 34 | } 35 | 36 | STDMETHODIMP CBoxSafeObject::XObjectSafety::GetInterfaceSafetyOptions(REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions) 37 | { 38 | if (!s_bObjectSafety) 39 | return E_NOINTERFACE; 40 | 41 | if (pdwSupportedOptions == NULL || pdwEnabledOptions == NULL) 42 | return E_POINTER; 43 | 44 | *pdwSupportedOptions = 3; 45 | *pdwEnabledOptions = 1; 46 | 47 | return S_OK; 48 | } 49 | 50 | STDMETHODIMP CBoxSafeObject::XObjectSafety::SetInterfaceSafetyOptions(REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions) 51 | { 52 | if (!s_bObjectSafety) 53 | return E_NOINTERFACE; 54 | 55 | return S_OK; 56 | } 57 | -------------------------------------------------------------------------------- /NetBox2/BoxSafeObject.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | extern BOOL s_bObjectSafety; 7 | // CBoxSafeObject command target 8 | 9 | class CBoxSafeObject : public CCmdTarget 10 | { 11 | DECLARE_DYNAMIC(CBoxSafeObject) 12 | 13 | public: 14 | CBoxSafeObject(void) 15 | { 16 | EnableAutomation(); 17 | } 18 | 19 | BEGIN_INTERFACE_PART(ObjectSafety, IObjectSafety) 20 | STDMETHOD(GetInterfaceSafetyOptions)(REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions); 21 | STDMETHOD(SetInterfaceSafetyOptions)(REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions); 22 | END_INTERFACE_PART(ObjectSafety) 23 | 24 | protected: 25 | DECLARE_INTERFACE_MAP() 26 | }; 27 | 28 | 29 | -------------------------------------------------------------------------------- /NetBox2/BoxScript.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NetBox2/BoxScript.cpp -------------------------------------------------------------------------------- /NetBox2/BoxScriptContext.cpp: -------------------------------------------------------------------------------- 1 | // BoxScriptContext.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "BoxScriptContext.h" 6 | 7 | // CBoxScriptContext 8 | 9 | IMPLEMENT_DYNCREATE(CBoxScriptContext, CWnd) 10 | 11 | BEGIN_DISPATCH_MAP(CBoxScriptContext, CWnd) 12 | DISP_FUNCTION_ID(CBoxScriptContext, "", 9465, Start, VT_EMPTY, VTS_I4) 13 | DISP_FUNCTION(CBoxScriptContext, "SetAbort", SetAbort, VT_EMPTY, VTS_NONE) 14 | DISP_FUNCTION(CBoxScriptContext, "SetCommit", SetCommit, VT_EMPTY, VTS_NONE) 15 | END_DISPATCH_MAP() 16 | 17 | // CBoxScriptContext message handlers 18 | 19 | void CBoxScriptContext::Start(long sc) 20 | { 21 | CComPtr pHost; 22 | 23 | pHost = CScriptHost::GetCurrentScript(); 24 | m_pTranspHost = CScriptHost::GetTransScript(); 25 | if(pHost != NULL) 26 | { 27 | pHost->AddNameItem(_T("ObjectContext"), GetIDispatch(FALSE)); 28 | pHost->SetScriptState((SCRIPTSTATE)sc); 29 | } 30 | } 31 | 32 | void CBoxScriptContext::SetAbort(void) 33 | { 34 | if(m_pTranspHost != NULL) 35 | m_pTranspHost->SetCommit(FALSE); 36 | } 37 | 38 | void CBoxScriptContext::SetCommit(void) 39 | { 40 | if(m_pTranspHost != NULL) 41 | m_pTranspHost->SetCommit(); 42 | } 43 | 44 | -------------------------------------------------------------------------------- /NetBox2/BoxScriptContext.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ScriptHost.h" 4 | 5 | // CBoxScriptContext 6 | 7 | class CBoxScriptContext : public CBoxSafeObject 8 | { 9 | DECLARE_DYNCREATE(CBoxScriptContext) 10 | 11 | public: 12 | afx_msg void Start(long sc); 13 | afx_msg void SetAbort(void); 14 | afx_msg void SetCommit(void); 15 | 16 | DECLARE_DISPATCH_MAP() 17 | 18 | CComPtr m_pTranspHost; 19 | }; 20 | 21 | 22 | -------------------------------------------------------------------------------- /NetBox2/BoxScriptError.cpp: -------------------------------------------------------------------------------- 1 | // ScriptError.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "BoxScriptError.h" 6 | 7 | 8 | // CBoxScriptError 9 | 10 | IMPLEMENT_DYNAMIC(CBoxScriptError, CBoxSafeObject) 11 | 12 | 13 | BEGIN_DISPATCH_MAP(CBoxScriptError, CBoxSafeObject) 14 | DISP_PROPERTY(CBoxScriptError, "ASPCode", m_strASPCode, VT_BSTR) 15 | DISP_PROPERTY(CBoxScriptError, "Number", m_nNumber, VT_I4) 16 | DISP_PROPERTY(CBoxScriptError, "Source", m_strSource, VT_BSTR) 17 | DISP_PROPERTY(CBoxScriptError, "Category", m_strCategory, VT_BSTR) 18 | DISP_PROPERTY(CBoxScriptError, "File", m_strFile, VT_BSTR) 19 | DISP_PROPERTY(CBoxScriptError, "Line", m_nLine, VT_I4) 20 | DISP_PROPERTY(CBoxScriptError, "Column", m_nColumn, VT_I4) 21 | DISP_PROPERTY(CBoxScriptError, "Description", m_strDescription, VT_BSTR) 22 | DISP_PROPERTY(CBoxScriptError, "ASPDescription", m_strASPDescription, VT_BSTR) 23 | END_DISPATCH_MAP() 24 | 25 | // CBoxScriptError message handlers 26 | 27 | -------------------------------------------------------------------------------- /NetBox2/BoxScriptError.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "BoxScript.h" 5 | 6 | // CScriptError command target 7 | 8 | class CBoxScriptError : public CBoxSafeObject 9 | { 10 | DECLARE_DYNAMIC(CBoxScriptError) 11 | public: 12 | void Bind(CBoxScript::CScriptError &error) 13 | { 14 | m_strCategory = error.m_strSource; 15 | m_nNumber = error.m_sCode; 16 | m_strFile = error.m_strFile; 17 | m_nLine = error.m_nLine; 18 | m_nColumn = -1; 19 | m_strDescription = error.m_strDescription; 20 | } 21 | 22 | public: 23 | DECLARE_DISPATCH_MAP() 24 | 25 | private: 26 | CString m_strASPCode; 27 | long m_nNumber; 28 | CString m_strSource; 29 | CString m_strCategory; 30 | CString m_strFile; 31 | long m_nLine; 32 | long m_nColumn; 33 | CString m_strDescription; 34 | CString m_strASPDescription; 35 | }; 36 | 37 | 38 | -------------------------------------------------------------------------------- /NetBox2/BoxScriptObject.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "BoxScript.h" 3 | #include "BoxSimpleXml.h" 4 | #include 5 | 6 | class CBoxScriptObject : public CBoxScript 7 | { 8 | DECLARE_DYNCREATE(CBoxScriptObject) 9 | 10 | BEGIN_INTERFACE_PART(ScriptDisp, IDispatch) 11 | static void staticRelease(void* dwParam); 12 | STDMETHOD(GetTypeInfoCount)(UINT *pctinfo); 13 | STDMETHOD(GetTypeInfo)(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo); 14 | STDMETHOD(GetIDsOfNames)(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId); 15 | STDMETHOD(Invoke)(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr); 16 | END_INTERFACE_PART(ScriptDisp) 17 | 18 | BEGIN_INTERFACE_PART(ObjectSafety1, IObjectSafety) 19 | STDMETHOD(GetInterfaceSafetyOptions)(REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions); 20 | STDMETHOD(SetInterfaceSafetyOptions)(REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions); 21 | END_INTERFACE_PART(ObjectSafety1) 22 | 23 | public: 24 | CBoxScriptObject(void); 25 | virtual ~CBoxScriptObject(void); 26 | 27 | protected: 28 | virtual void InitScript(void); 29 | virtual int ParseScriptText(LPCSTR pstrText, int nCount, CStringA& strScriptText, int nIncludeFlagIndex); 30 | virtual int AfterParse(void); 31 | virtual void ClearScript(void); 32 | int MapDispId(void); 33 | 34 | public: 35 | CString& GetProgID(void) 36 | { 37 | return m_strProgID; 38 | } 39 | 40 | CLSID& GetClassID(void) 41 | { 42 | return m_ClassID; 43 | } 44 | 45 | BOOL IsPooled(void) 46 | { 47 | return m_pHost->m_arrayExtData[1]; 48 | } 49 | 50 | public: 51 | afx_msg LPDISPATCH get_Object(void); 52 | afx_msg int Init(void); 53 | afx_msg long Run(void); 54 | afx_msg LPDISPATCH LoadObject(LPCTSTR pstrFile); 55 | afx_msg BSTR get_ProgID(void); 56 | afx_msg BSTR get_ClassID(void); 57 | 58 | DECLARE_DISPATCH_MAP() 59 | 60 | public: 61 | static CComPtr m_pGlobalObject; 62 | 63 | private: 64 | void Clear(void); 65 | 66 | DWORD m_dwCookie; 67 | CCriticalSection m_csCookie; 68 | 69 | CComDispatchDriver m_pScriptDisp; 70 | CString m_strProgID; 71 | CLSID m_ClassID; 72 | CBoxObject m_pXml; 73 | DISPID* m_parrayDispIdMap; 74 | DISPID m_idDefault; 75 | 76 | int m_nScriptLine; 77 | }; 78 | -------------------------------------------------------------------------------- /NetBox2/BoxService.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | 7 | // CBoxService command target 8 | 9 | class CBoxService : public CBoxSafeObject 10 | { 11 | DECLARE_DYNAMIC(CBoxService) 12 | public: 13 | CBoxService(); 14 | ~CBoxService(); 15 | 16 | public: 17 | void Main(); 18 | static void WINAPI service_main(DWORD dwArgc, LPTSTR *lpszArgv); 19 | static void WINAPI service_ctrl(DWORD dwCtrlCode); 20 | void Control(DWORD dwCtrlCode); 21 | void Dispatch(LPCTSTR pstrName); 22 | 23 | void Halt(void); 24 | 25 | CString m_strName; 26 | 27 | public: 28 | afx_msg BOOL get_Installed(void); 29 | afx_msg BOOL get_Running(void); 30 | 31 | afx_msg void Install(VARIANT& varType); 32 | afx_msg void Remove(void); 33 | afx_msg void Start(void); 34 | afx_msg void Restart(void); 35 | afx_msg void Stop(void); 36 | afx_msg void LogEvent(long nType, LPCTSTR pstrMsg); 37 | afx_msg void SetTimer(long uElapse); 38 | afx_msg BSTR get_Icon(void); 39 | afx_msg void put_Icon(LPCTSTR pstrName); 40 | afx_msg void DoEvents(void); 41 | afx_msg void RunService(LPCTSTR pstrName, VARIANT* pVarDisplay, VARIANT* pVarDescription); 42 | afx_msg void SendCommand(short uCtrl); 43 | afx_msg void AppendCommand(short uCtrl, VARIANT* pVarName); 44 | 45 | DECLARE_DISPATCH_MAP() 46 | 47 | private: 48 | void ReportStatusToSCMgr(DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint); 49 | static LRESULT CALLBACK StaticMainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); 50 | LRESULT MainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); 51 | 52 | void OnStart(void); 53 | void OnStop(void); 54 | void OnPause(void); 55 | void OnResume(void); 56 | void OnTimer(void); 57 | void OnCommand(long dwCtrlCode); 58 | 59 | CString m_strIcon; 60 | NOTIFYICONDATA m_tnd; 61 | SERVICE_STATUS_HANDLE m_sshStatusHandle; 62 | SERVICE_STATUS m_ssStatus; 63 | DWORD m_dwError; 64 | BOOL m_bCheckReg; 65 | BOOL m_bDesktop; 66 | BOOL m_bTrayIcon; 67 | BOOL m_nAutoRestart; 68 | CString m_strDisplayName; 69 | CString m_strDescription; 70 | DWORD m_uElapse; 71 | HWND m_hShellWnd; 72 | HMENU m_hMenu; 73 | BOOL m_bUserMenu; 74 | long m_bServiceType; 75 | POINT m_mPos; 76 | __int64 m_nMenuDelay; 77 | BOOL m_bInBLCLK; 78 | __int64 m_nTimer; 79 | __int64 m_nFreq; 80 | }; 81 | -------------------------------------------------------------------------------- /NetBox2/BoxSmtp.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | #include "BoxObject.h" 4 | #include "BoxSocket.h" 5 | 6 | // CBoxSmtp command target 7 | 8 | class CBoxSmtp : public CBoxSafeObject 9 | { 10 | DECLARE_DYNCREATE(CBoxSmtp) 11 | 12 | public: 13 | CBoxSmtp(void) 14 | { 15 | m_pSocket.CreateInstance(); 16 | } 17 | virtual ~CBoxSmtp(){Close();} 18 | 19 | public: 20 | afx_msg void Close(void); 21 | afx_msg long Connect(LPCTSTR pstrHostAddress, UINT nHostPort); 22 | afx_msg long SSLConnect(LPCTSTR pstrHostAddress, UINT nHostPort); 23 | 24 | afx_msg long Hello(LPCTSTR pstrDomain); 25 | afx_msg long mailFrom(LPCTSTR pstrMail); 26 | afx_msg long rcptTo(LPCTSTR pstrMail); 27 | afx_msg long Reset(); 28 | 29 | afx_msg long sendData(LPCTSTR pstrData); 30 | afx_msg long BeginData(); 31 | afx_msg long EndData(); 32 | afx_msg void WriteData(LPCTSTR pstrData); 33 | 34 | afx_msg long sendMail(LPCTSTR pstrMailFrom, LPCTSTR pstrMailTo, LPCTSTR pstrData); 35 | 36 | DECLARE_DISPATCH_MAP() 37 | 38 | private: 39 | int waitResponse(int ErrNo); 40 | 41 | CBoxObject m_pSocket; 42 | }; 43 | -------------------------------------------------------------------------------- /NetBox2/BoxSocket.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NetBox2/BoxSocket.cpp -------------------------------------------------------------------------------- /NetBox2/BoxStream.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | // CBoxStream command target 6 | 7 | class CBoxStream : public CBoxSafeObject 8 | { 9 | DECLARE_DYNAMIC(CBoxStream) 10 | public: 11 | BEGIN_INTERFACE_PART(Stream, IStream) 12 | STDMETHOD(Read)(void *pv, ULONG cb, ULONG *pcbRead); 13 | STDMETHOD(Write)(const void *pv, ULONG cb, ULONG *pcbWritten); 14 | STDMETHOD(Seek)(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition); 15 | STDMETHOD(SetSize)(ULARGE_INTEGER libNewSize); 16 | STDMETHOD(CopyTo)(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten); 17 | STDMETHOD(Commit)(DWORD grfCommitFlags); 18 | STDMETHOD(Revert)( void); 19 | STDMETHOD(LockRegion)(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType); 20 | STDMETHOD(UnlockRegion)(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType); 21 | STDMETHOD(Stat)(STATSTG *pstatstg, DWORD grfStatFlag); 22 | STDMETHOD(Clone)(IStream **ppstm); 23 | END_INTERFACE_PART(Stream) 24 | 25 | virtual HRESULT StreamRead(void *pv, ULONG cb, ULONG *pcbRead); 26 | virtual HRESULT StreamWrite(const void *pv, ULONG cb, ULONG *pcbWritten); 27 | virtual HRESULT StreamSeek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition); 28 | 29 | protected: 30 | DECLARE_INTERFACE_MAP() 31 | }; 32 | -------------------------------------------------------------------------------- /NetBox2/BoxString.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include 3 | #include 4 | #include 5 | 6 | #include "BoxString.h" 7 | 8 | void CBoxEncode::HtmlEncode(CString &str) 9 | { 10 | TCHAR* pszEncoded = new TCHAR[str.GetLength() * 6 + 1]; 11 | int nLength = 0; 12 | TCHAR ch; 13 | 14 | for(int i = 0; i < str.GetLength(); i ++) 15 | { 16 | switch(ch = str[i]) 17 | { 18 | case _T('\"'): 19 | _tcscpy(pszEncoded + nLength, _T(""")); 20 | nLength += 6; 21 | break; 22 | case _T('<'): 23 | _tcscpy(pszEncoded + nLength, _T("<")); 24 | nLength += 4; 25 | break; 26 | case _T('>'): 27 | _tcscpy(pszEncoded + nLength, _T(">")); 28 | nLength += 4; 29 | break; 30 | case _T('&'): 31 | _tcscpy(pszEncoded + nLength, _T("&")); 32 | nLength += 5; 33 | break; 34 | default: 35 | pszEncoded[nLength ++] = ch; 36 | } 37 | } 38 | 39 | pszEncoded[nLength] = 0; 40 | 41 | str = pszEncoded; 42 | delete pszEncoded; 43 | } 44 | -------------------------------------------------------------------------------- /NetBox2/BoxString.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace CBoxEncode 4 | { 5 | void HtmlEncode(CString &str); 6 | }; 7 | -------------------------------------------------------------------------------- /NetBox2/BoxSystem.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NetBox2/BoxSystem.cpp -------------------------------------------------------------------------------- /NetBox2/BoxTcpServer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BoxJobServer.h" 4 | #include "BoxSocket.h" 5 | 6 | // CBoxTcpServer 7 | 8 | class CBoxTcpServer : public CBoxJobServer 9 | { 10 | DECLARE_DYNCREATE(CBoxTcpServer) 11 | 12 | public: 13 | CBoxTcpServer(); 14 | virtual ~CBoxTcpServer(); 15 | 16 | virtual void OnJobEnd(VARIANT& var, long retVal); 17 | virtual BOOL OnJobStart(VARIANT& var); 18 | 19 | public: 20 | afx_msg BOOL get_Running(void); 21 | 22 | afx_msg long Create(LPCTSTR pstrSocketAddress, UINT nSocketPort, LPCTSTR pstrAcceptClass); 23 | afx_msg void Start(void); 24 | afx_msg void Stop(void); 25 | afx_msg void Close(void); 26 | afx_msg void AddSocket(VARIANT& varSocket); 27 | 28 | afx_msg long EnableSSL(LPCTSTR PrivateKey, LPCTSTR pstrCertificate); 29 | afx_msg long get_SSLSessionTimeout(void); 30 | afx_msg void put_SSLSessionTimeout(long tm); 31 | 32 | afx_msg long get_ConnectLimit(void); 33 | afx_msg void put_ConnectLimit(long nConnectLimit); 34 | 35 | long get_LocalPort(void); 36 | 37 | DECLARE_DISPATCH_MAP() 38 | 39 | protected: 40 | CBoxObject m_pSocket; 41 | BOOL m_bRunning; 42 | 43 | BOOL m_bSSL; 44 | long m_nConnectTimeout; 45 | 46 | CSSLContext m_SSL_CTX; 47 | 48 | private: 49 | static UINT staticListenThread(void* p); 50 | void ListenThread(); 51 | 52 | CWinThread *m_pListenThread; 53 | 54 | private: 55 | static VOID CALLBACK IoCompletionRoutine(DWORD dwErrorCode, DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped); 56 | static void CALLBACK PreRead(ULONG_PTR dwParam); 57 | 58 | static UINT staticPreReadThread(void* p); 59 | void PreReadThread(); 60 | static void CALLBACK StopPreThread(ULONG_PTR dwParam); 61 | 62 | CWinThread *m_pPreReadThread; 63 | 64 | private: 65 | class CSendData : public OVERLAPPED 66 | { 67 | public: 68 | ~CSendData(void) 69 | { 70 | } 71 | 72 | CBoxObject m_pSocket; 73 | long m_nStart; 74 | long m_nLen; 75 | long m_retVal; 76 | 77 | CAutoPtr m_pBuf; 78 | }; 79 | 80 | static void CALLBACK SendData(ULONG_PTR dwParam); 81 | static VOID CALLBACK SendIoCompletionRoutine(DWORD dwErrorCode, DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped); 82 | void SendData(CBoxSocket* pSocket, long retVal); 83 | long OnSent(CBoxJobWorker* pJobWorker); 84 | }; 85 | -------------------------------------------------------------------------------- /NetBox2/BoxTimeCache.cpp: -------------------------------------------------------------------------------- 1 | // BoxTimeCache.cpp : implementation file 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "NetBox2.h" 6 | #include "BoxTimeCache.h" 7 | #include "BoxJobServer.h" 8 | #include "ScriptHost.h" 9 | #include "sice.h" 10 | 11 | static CCriticalSection g_csBoxTimeCache; 12 | static CBoxTimeCache* g_pBoxTimeCache; 13 | 14 | // CBoxTimeCache 15 | 16 | CBoxTimeCache::CBoxTimeCache() 17 | { 18 | GetNewTime(); 19 | 20 | m_bAutoDelete = FALSE; 21 | CreateThread(); 22 | } 23 | 24 | void CBoxTimeCache::OnFinalRelease() 25 | { 26 | CSingleLock l(&g_csBoxTimeCache, TRUE); 27 | g_pBoxTimeCache = NULL; 28 | l.Unlock(); 29 | 30 | WaitForSingleObject(m_hThread, INFINITE); 31 | 32 | CWinThread::OnFinalRelease(); 33 | } 34 | 35 | BOOL CBoxTimeCache::InitInstance() 36 | { 37 | //::CoInitializeEx(NULL, COINIT_MULTITHREADED); 38 | AfxOleInit(); 39 | 40 | theApp.SetThreadName(_T("TimeCache")); 41 | CBThread th; 42 | 43 | while(m_dwRef != 0) 44 | { 45 | GetNewTime(); 46 | Sleep(1); 47 | } 48 | 49 | return FALSE; 50 | } 51 | 52 | void CBoxTimeCache::GetNewTime(void) 53 | { 54 | SYSTEMTIME st; 55 | __int64 ft; 56 | 57 | GetSystemTime(&st); 58 | st.wMilliseconds = 0; 59 | SystemTimeToFileTime(&st, (FILETIME*)&ft); 60 | 61 | if(m_pTime == NULL) 62 | { 63 | m_pTime.CreateInstance(); 64 | m_pTime->m_time = ft; 65 | TimeToString(st, m_pTime->m_strTime); 66 | return; 67 | } 68 | 69 | CBoxJobServer::OnTimeIdle(ft); 70 | CScriptHost::CheckTimeout(ft); 71 | 72 | if(m_pTime->m_time != ft) 73 | { 74 | CBoxObject pTime; 75 | 76 | pTime.CreateInstance(); 77 | pTime->m_time = ft; 78 | TimeToString(st, pTime->m_strTime); 79 | 80 | CSingleLock l(&m_cs, TRUE); 81 | m_pTime = pTime; 82 | } 83 | } 84 | 85 | void CBoxTimeCache::GetNewTimeCache(CBoxObject& pBoxTimeCache) 86 | { 87 | CSingleLock l(&g_csBoxTimeCache, TRUE); 88 | 89 | if(g_pBoxTimeCache == NULL) 90 | { 91 | pBoxTimeCache.CreateInstance(); 92 | g_pBoxTimeCache = pBoxTimeCache; 93 | }else 94 | pBoxTimeCache = g_pBoxTimeCache; 95 | } 96 | 97 | // CBoxTimeCache message handlers 98 | 99 | -------------------------------------------------------------------------------- /NetBox2/BoxTimeCache.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BoxObject.h" 4 | 5 | // CBoxTimeCache 6 | 7 | class CBoxTimeCache : public CWinThread 8 | { 9 | public: 10 | class CTime : public CBoxBaseObject 11 | { 12 | public: 13 | __int64 m_time; 14 | CString m_strTime; 15 | }; 16 | 17 | class CCache 18 | { 19 | public: 20 | CCache(void) : m_pBoxTimeCache(NULL) 21 | { 22 | CBoxTimeCache::GetNewTimeCache(m_pBoxTimeCache); 23 | } 24 | 25 | void GetTime(CBoxObject& pTime) 26 | { 27 | m_pBoxTimeCache->GetTime(pTime); 28 | } 29 | 30 | private: 31 | CBoxObject m_pBoxTimeCache; 32 | }; 33 | 34 | CBoxTimeCache(); // protected constructor used by dynamic creation 35 | 36 | public: 37 | virtual BOOL InitInstance(); 38 | virtual void OnFinalRelease(); 39 | 40 | public: 41 | static void GetNewTimeCache(CBoxObject& pBoxTimeCache); 42 | void GetTime(CBoxObject& pTime) 43 | { 44 | CSingleLock l(&m_cs, TRUE); 45 | 46 | pTime = m_pTime; 47 | } 48 | 49 | private: 50 | void GetNewTime(void); 51 | 52 | CCriticalSection m_cs; 53 | CBoxObject m_pTime; 54 | }; 55 | -------------------------------------------------------------------------------- /NetBox2/BoxZipFile.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "BoxFile.h" 3 | 4 | class CBoxZipFile : public CBoxFile 5 | { 6 | public: 7 | CBoxZipFile(void); 8 | 9 | public: 10 | virtual CFile* Open(LPCTSTR pstrName); 11 | virtual SYSTEMTIME GetFileTime(CFile* pFile); 12 | int ExtractFile(LPCTSTR pstrName, LPCTSTR pstrDest); 13 | 14 | private: 15 | CCriticalSection m_cs; 16 | CMapStringToPtr m_mapIndex; 17 | CBoxSafeFile m_fileMe; 18 | SYSTEMTIME m_tm; 19 | }; 20 | 21 | -------------------------------------------------------------------------------- /NetBox2/MemoryModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Memory DLL loading code 3 | * Version 0.0.2 4 | * 5 | * Copyright (c) 2004-2011 by Joachim Bauch / mail@joachim-bauch.de 6 | * http://www.joachim-bauch.de 7 | * 8 | * The contents of this file are subject to the Mozilla Public License Version 9 | * 1.1 (the "License"); you may not use this file except in compliance with 10 | * the License. You may obtain a copy of the License at 11 | * http://www.mozilla.org/MPL/ 12 | * 13 | * Software distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 15 | * for the specific language governing rights and limitations under the 16 | * License. 17 | * 18 | * The Original Code is MemoryModule.h 19 | * 20 | * The Initial Developer of the Original Code is Joachim Bauch. 21 | * 22 | * Portions created by Joachim Bauch are Copyright (C) 2004-2011 23 | * Joachim Bauch. All Rights Reserved. 24 | * 25 | */ 26 | 27 | #ifndef __MEMORY_MODULE_HEADER 28 | #define __MEMORY_MODULE_HEADER 29 | 30 | #include 31 | #include 32 | 33 | typedef void *HMEMORYMODULE; 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | HMEMORYMODULE MemoryLoadLibrary(const void *); 40 | 41 | FARPROC MemoryGetProcAddress(HMEMORYMODULE, const char *); 42 | 43 | void MemoryFreeLibrary(HMEMORYMODULE); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif // __MEMORY_MODULE_HEADER 50 | -------------------------------------------------------------------------------- /NetBox2/NetBox.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NetBox2/NetBox.ico -------------------------------------------------------------------------------- /NetBox2/NetBox.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Netbox Project 17 | 18 | 19 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /NetBox2/NetBox2.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 9.00 2 | # Visual Studio 2005 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NetBox2", "NetBox2.vcproj", "{1251DFBB-FD94-406D-ADA7-5642C722654B}" 4 | ProjectSection(ProjectDependencies) = postProject 5 | {1FCADE1B-1E5B-4937-9FF3-49827D484A7A} = {1FCADE1B-1E5B-4937-9FF3-49827D484A7A} 6 | {BCAEF854-F49D-481E-A9DD-59DA4B03DEDD} = {BCAEF854-F49D-481E-A9DD-59DA4B03DEDD} 7 | EndProjectSection 8 | EndProject 9 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BoxLib", "..\BoxLib\BoxLib.vcproj", "{1FCADE1B-1E5B-4937-9FF3-49827D484A7A}" 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NBR", "..\NBR\NBR.vcproj", "{BCAEF854-F49D-481E-A9DD-59DA4B03DEDD}" 12 | ProjectSection(ProjectDependencies) = postProject 13 | {1FCADE1B-1E5B-4937-9FF3-49827D484A7A} = {1FCADE1B-1E5B-4937-9FF3-49827D484A7A} 14 | EndProjectSection 15 | EndProject 16 | Global 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|Win32 = Debug|Win32 19 | Release|Win32 = Release|Win32 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {1251DFBB-FD94-406D-ADA7-5642C722654B}.Debug|Win32.ActiveCfg = Debug|Win32 23 | {1251DFBB-FD94-406D-ADA7-5642C722654B}.Debug|Win32.Build.0 = Debug|Win32 24 | {1251DFBB-FD94-406D-ADA7-5642C722654B}.Release|Win32.ActiveCfg = Release|Win32 25 | {1251DFBB-FD94-406D-ADA7-5642C722654B}.Release|Win32.Build.0 = Release|Win32 26 | {1FCADE1B-1E5B-4937-9FF3-49827D484A7A}.Debug|Win32.ActiveCfg = Debug|Win32 27 | {1FCADE1B-1E5B-4937-9FF3-49827D484A7A}.Debug|Win32.Build.0 = Debug|Win32 28 | {1FCADE1B-1E5B-4937-9FF3-49827D484A7A}.Release|Win32.ActiveCfg = Release|Win32 29 | {1FCADE1B-1E5B-4937-9FF3-49827D484A7A}.Release|Win32.Build.0 = Release|Win32 30 | {BCAEF854-F49D-481E-A9DD-59DA4B03DEDD}.Debug|Win32.ActiveCfg = Debug|Win32 31 | {BCAEF854-F49D-481E-A9DD-59DA4B03DEDD}.Debug|Win32.Build.0 = Debug|Win32 32 | {BCAEF854-F49D-481E-A9DD-59DA4B03DEDD}.Release|Win32.ActiveCfg = Release|Win32 33 | {BCAEF854-F49D-481E-A9DD-59DA4B03DEDD}.Release|Win32.Build.0 = Release|Win32 34 | EndGlobalSection 35 | GlobalSection(SolutionProperties) = preSolution 36 | HideSolutionNode = FALSE 37 | EndGlobalSection 38 | EndGlobal 39 | -------------------------------------------------------------------------------- /NetBox2/NetBox2.vcproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "relative:NetBox2" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /NetBox2/NetBox2.vsscc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NetBox2/NetBox2.vsscc -------------------------------------------------------------------------------- /NetBox2/NetBox2.vssscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "relative:NetBox2" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT" 10 | } 11 | -------------------------------------------------------------------------------- /NetBox2/PubFun.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | void TimeToString(const SYSTEMTIME& st, CString &strTime) 4 | { 5 | static TCHAR szMonth[][4] = 6 | { 7 | _T("Jan"), _T("Feb"), _T("Mar"), _T("Apr"), _T("May"), _T("Jun"), 8 | _T("Jul"), _T("Aug"), _T("Sep"), _T("Oct"), _T("Nov"), _T("Dec") 9 | }; 10 | 11 | static TCHAR szDays[][4] = 12 | { 13 | _T("Sun"), _T("Mon"), _T("Tue"), _T("Wed"), _T("Thu"), _T("Fri"), _T("Sat") 14 | }; 15 | 16 | strTime.Format(_T("%s, %02d %s %d %02d:%02d:%02d GMT"), 17 | szDays[st.wDayOfWeek], st.wDay, szMonth[st.wMonth-1], st.wYear, 18 | st.wHour, st.wMinute, st.wSecond); 19 | } 20 | 21 | -------------------------------------------------------------------------------- /NetBox2/ReadMe.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NetBox2/ReadMe.txt -------------------------------------------------------------------------------- /NetBox2/ScriptHost.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NetBox2/ScriptHost.cpp -------------------------------------------------------------------------------- /NetBox2/X509Certificate.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class CX509Certificate 6 | { 7 | public: 8 | 9 | CX509Certificate(void) : m_pCertificate(NULL) 10 | { 11 | } 12 | 13 | ~CX509Certificate(void) 14 | { 15 | free(); 16 | } 17 | 18 | operator X509*(void) 19 | { return m_pCertificate;} 20 | 21 | X509* operator=(X509* p) 22 | { 23 | if(m_pCertificate != NULL) 24 | X509_free(m_pCertificate); 25 | 26 | m_pCertificate = p; 27 | return m_pCertificate; 28 | } 29 | 30 | X509* operator=(CX509Certificate& p) 31 | { return operator=(p.m_pCertificate);} 32 | 33 | 34 | void free(void) 35 | { 36 | if(m_pCertificate != NULL) 37 | { 38 | X509_free(m_pCertificate); 39 | m_pCertificate = NULL; 40 | } 41 | } 42 | 43 | private: 44 | X509* m_pCertificate; 45 | }; 46 | -------------------------------------------------------------------------------- /NetBox2/ZipFile.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #ifndef Z_BUFSIZE 9 | #define Z_BUFSIZE 16384 10 | #endif 11 | 12 | // CZip command target 13 | 14 | class CZipFile : public CFile 15 | { 16 | public: 17 | CZipFile(); 18 | 19 | virtual ~CZipFile(); 20 | 21 | BOOL Open(CFile* pFile, UINT nOpenFlags); 22 | 23 | virtual UINT Read(void* lpBuf, UINT nCount); 24 | virtual void Write(const void* lpBuf, UINT nCount); 25 | 26 | virtual void Close(); 27 | 28 | void SetKey(const unsigned char *data) 29 | { 30 | RC4_set_key(&m_key, MD5_DIGEST_LENGTH, data); 31 | m_bHasRC4 = TRUE; 32 | } 33 | 34 | private: 35 | void clear(); 36 | UINT RC4Read(void* lpBuf, UINT nCount); 37 | void RC4Write(const void* lpBuf, UINT nCount); 38 | 39 | Byte m_Buffer[Z_BUFSIZE]; 40 | z_stream stream; 41 | BOOL m_bEof; 42 | UINT m_nOpenFlags; 43 | 44 | CFile *m_pFile; 45 | 46 | RC4_KEY m_key; 47 | BOOL m_bHasRC4; 48 | }; 49 | -------------------------------------------------------------------------------- /NetBox2/bin1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NetBox2/bin1.bin -------------------------------------------------------------------------------- /NetBox2/msg.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NetBox2/msg.bin -------------------------------------------------------------------------------- /NetBox2/nbFile.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NetBox2/nbFile.ico -------------------------------------------------------------------------------- /NetBox2/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by NetBox2.rc 4 | // 5 | #define IDR_MANIFEST 1 6 | #define VS_VERSION_INFO 1 7 | #define IDI_ICON1 115 8 | 9 | // Next default values for new objects 10 | // 11 | #ifdef APSTUDIO_INVOKED 12 | #ifndef APSTUDIO_READONLY_SYMBOLS 13 | #define _APS_NEXT_RESOURCE_VALUE 116 14 | #define _APS_NEXT_COMMAND_VALUE 40001 15 | #define _APS_NEXT_CONTROL_VALUE 1001 16 | #define _APS_NEXT_SYMED_VALUE 101 17 | #endif 18 | #endif 19 | -------------------------------------------------------------------------------- /NetBox2/sice.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | inline BOOL SimpleIce() 4 | { 5 | static TCHAR *pFiles[9] = 6 | { 7 | _T("\\\\.\\SICE"), 8 | _T("\\\\.\\SIWVID"), 9 | _T("\\\\.\\NTICE"), 10 | _T("\\\\.\\TRW"), 11 | _T("\\\\.\\TRW2000"), 12 | _T("\\\\.\\TRDEBUG"), 13 | _T("\\\\.\\REGVXD"), 14 | _T("\\\\.\\VKEYPRO"), 15 | _T("\\\\.\\FILEVXD") 16 | }; 17 | HANDLE hFile; 18 | 19 | for(int i = 0; i < 9; i ++) 20 | { 21 | hFile = CreateFile( pFiles[i], GENERIC_READ | GENERIC_WRITE, 22 | FILE_SHARE_READ | FILE_SHARE_WRITE, 23 | NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); 24 | if( hFile != INVALID_HANDLE_VALUE ) 25 | { 26 | CloseHandle(hFile); 27 | return TRUE; 28 | } 29 | } 30 | 31 | return FALSE; 32 | } 33 | 34 | 35 | -------------------------------------------------------------------------------- /NetBox2/small.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/NetBox2/small.ico -------------------------------------------------------------------------------- /NetBox2/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // NetBox2.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | #define JSON_IS_AMALGAMATION 5 | 6 | #include "stdafx.h" 7 | 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | netbox 2 | ====== 3 | 4 | asp 应用服务器,十年前的项目,一直有用户希望开源 5 | -------------------------------------------------------------------------------- /新建BoxLib对象.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mirror4/netbox/8041888ed99d74372d284cb8b61939b44f8965c9/新建BoxLib对象.txt --------------------------------------------------------------------------------