This commit is contained in:
blackorbird
2019-04-18 11:19:12 +08:00
parent f6c2839353
commit b3c7e3e449
495 changed files with 73786 additions and 0 deletions

View File

@@ -0,0 +1,382 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 5.01.0164 */
/* at Mon Oct 13 07:34:24 2003
*/
/* Compiler settings for C:\users\sansan\testVersion\Downloader\IDManTypeInfo.idl:
Os (OptLev=s), W1, Zp8, env=Win32, ms_ext, c_ext
error checks: allocation ref bounds_check enum stub_data
*/
//@@MIDL_FILE_HEADING( )
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 440
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __IDManTypeInfo_h__
#define __IDManTypeInfo_h__
#ifdef __cplusplus
extern "C"{
#endif
/* Forward Declarations */
#ifndef __ICIDMLinkTransmitter_FWD_DEFINED__
#define __ICIDMLinkTransmitter_FWD_DEFINED__
typedef interface ICIDMLinkTransmitter ICIDMLinkTransmitter;
#endif /* __ICIDMLinkTransmitter_FWD_DEFINED__ */
#ifndef __ICIDMLinkTransmitter2_FWD_DEFINED__
#define __ICIDMLinkTransmitter2_FWD_DEFINED__
typedef interface ICIDMLinkTransmitter2 ICIDMLinkTransmitter2;
#endif /* __ICIDMLinkTransmitter2_FWD_DEFINED__ */
#ifndef __CIDMLinkTransmitter_FWD_DEFINED__
#define __CIDMLinkTransmitter_FWD_DEFINED__
#ifdef __cplusplus
typedef class CIDMLinkTransmitter CIDMLinkTransmitter;
#else
typedef struct CIDMLinkTransmitter CIDMLinkTransmitter;
#endif /* __cplusplus */
#endif /* __CIDMLinkTransmitter_FWD_DEFINED__ */
/* header files for imported files */
#include "oaidl.h"
void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t);
void __RPC_USER MIDL_user_free( void __RPC_FAR * );
#ifndef __ICIDMLinkTransmitter_INTERFACE_DEFINED__
#define __ICIDMLinkTransmitter_INTERFACE_DEFINED__
/* interface ICIDMLinkTransmitter */
/* [unique][helpstring][oleautomation][uuid][object] */
EXTERN_C const IID IID_ICIDMLinkTransmitter;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("4BD46AAE-C51F-4BF7-8BC0-2E86E33D1873")
ICIDMLinkTransmitter : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE SendLinkToIDM(
/* [in] */ BSTR bstrUrl,
/* [in] */ BSTR bstrReferer,
/* [in] */ BSTR bstrCookies,
/* [in] */ BSTR bstrData,
/* [in] */ BSTR bstrUser,
/* [in] */ BSTR bstrPassword,
/* [in] */ BSTR bstrLocalPath,
/* [in] */ BSTR bstrLocalFileName,
/* [in] */ long lFlags) = 0;
};
#else /* C style interface */
typedef struct ICIDMLinkTransmitterVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
ICIDMLinkTransmitter __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
ICIDMLinkTransmitter __RPC_FAR * This);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
ICIDMLinkTransmitter __RPC_FAR * This);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SendLinkToIDM )(
ICIDMLinkTransmitter __RPC_FAR * This,
/* [in] */ BSTR bstrUrl,
/* [in] */ BSTR bstrReferer,
/* [in] */ BSTR bstrCookies,
/* [in] */ BSTR bstrData,
/* [in] */ BSTR bstrUser,
/* [in] */ BSTR bstrPassword,
/* [in] */ BSTR bstrLocalPath,
/* [in] */ BSTR bstrLocalFileName,
/* [in] */ long lFlags);
END_INTERFACE
} ICIDMLinkTransmitterVtbl;
interface ICIDMLinkTransmitter
{
CONST_VTBL struct ICIDMLinkTransmitterVtbl __RPC_FAR *lpVtbl;
};
#ifdef COBJMACROS
#define ICIDMLinkTransmitter_QueryInterface(This,riid,ppvObject) \
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
#define ICIDMLinkTransmitter_AddRef(This) \
(This)->lpVtbl -> AddRef(This)
#define ICIDMLinkTransmitter_Release(This) \
(This)->lpVtbl -> Release(This)
#define ICIDMLinkTransmitter_SendLinkToIDM(This,bstrUrl,bstrReferer,bstrCookies,bstrData,bstrUser,bstrPassword,bstrLocalPath,bstrLocalFileName,lFlags) \
(This)->lpVtbl -> SendLinkToIDM(This,bstrUrl,bstrReferer,bstrCookies,bstrData,bstrUser,bstrPassword,bstrLocalPath,bstrLocalFileName,lFlags)
#endif /* COBJMACROS */
#endif /* C style interface */
HRESULT STDMETHODCALLTYPE ICIDMLinkTransmitter_SendLinkToIDM_Proxy(
ICIDMLinkTransmitter __RPC_FAR * This,
/* [in] */ BSTR bstrUrl,
/* [in] */ BSTR bstrReferer,
/* [in] */ BSTR bstrCookies,
/* [in] */ BSTR bstrData,
/* [in] */ BSTR bstrUser,
/* [in] */ BSTR bstrPassword,
/* [in] */ BSTR bstrLocalPath,
/* [in] */ BSTR bstrLocalFileName,
/* [in] */ long lFlags);
void __RPC_STUB ICIDMLinkTransmitter_SendLinkToIDM_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __ICIDMLinkTransmitter_INTERFACE_DEFINED__ */
#ifndef __ICIDMLinkTransmitter2_INTERFACE_DEFINED__
#define __ICIDMLinkTransmitter2_INTERFACE_DEFINED__
/* interface ICIDMLinkTransmitter2 */
/* [unique][helpstring][oleautomation][uuid][object] */
EXTERN_C const IID IID_ICIDMLinkTransmitter2;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("94D09862-1875-4FC9-B434-91CF25C840A1")
ICIDMLinkTransmitter2 : public ICIDMLinkTransmitter
{
public:
virtual HRESULT STDMETHODCALLTYPE SendLinkToIDM2(
/* [in] */ BSTR bstrUrl,
/* [in] */ BSTR bstrReferer,
/* [in] */ BSTR bstrCookies,
/* [in] */ BSTR bstrData,
/* [in] */ BSTR bstrUser,
/* [in] */ BSTR bstrPassword,
/* [in] */ BSTR bstrLocalPath,
/* [in] */ BSTR bstrLocalFileName,
/* [in] */ long lFlags,
/* [in] */ VARIANT reserved1,
/* [in] */ VARIANT reserved2) = 0;
virtual HRESULT STDMETHODCALLTYPE SendLinksArray(
/* [in] */ BSTR location,
/* [in] */ VARIANT __RPC_FAR *pLinksArray) = 0;
};
#else /* C style interface */
typedef struct ICIDMLinkTransmitter2Vtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
ICIDMLinkTransmitter2 __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
ICIDMLinkTransmitter2 __RPC_FAR * This);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
ICIDMLinkTransmitter2 __RPC_FAR * This);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SendLinkToIDM )(
ICIDMLinkTransmitter2 __RPC_FAR * This,
/* [in] */ BSTR bstrUrl,
/* [in] */ BSTR bstrReferer,
/* [in] */ BSTR bstrCookies,
/* [in] */ BSTR bstrData,
/* [in] */ BSTR bstrUser,
/* [in] */ BSTR bstrPassword,
/* [in] */ BSTR bstrLocalPath,
/* [in] */ BSTR bstrLocalFileName,
/* [in] */ long lFlags);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SendLinkToIDM2 )(
ICIDMLinkTransmitter2 __RPC_FAR * This,
/* [in] */ BSTR bstrUrl,
/* [in] */ BSTR bstrReferer,
/* [in] */ BSTR bstrCookies,
/* [in] */ BSTR bstrData,
/* [in] */ BSTR bstrUser,
/* [in] */ BSTR bstrPassword,
/* [in] */ BSTR bstrLocalPath,
/* [in] */ BSTR bstrLocalFileName,
/* [in] */ long lFlags,
/* [in] */ VARIANT reserved1,
/* [in] */ VARIANT reserved2);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SendLinksArray )(
ICIDMLinkTransmitter2 __RPC_FAR * This,
/* [in] */ BSTR location,
/* [in] */ VARIANT __RPC_FAR *pLinksArray);
END_INTERFACE
} ICIDMLinkTransmitter2Vtbl;
interface ICIDMLinkTransmitter2
{
CONST_VTBL struct ICIDMLinkTransmitter2Vtbl __RPC_FAR *lpVtbl;
};
#ifdef COBJMACROS
#define ICIDMLinkTransmitter2_QueryInterface(This,riid,ppvObject) \
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
#define ICIDMLinkTransmitter2_AddRef(This) \
(This)->lpVtbl -> AddRef(This)
#define ICIDMLinkTransmitter2_Release(This) \
(This)->lpVtbl -> Release(This)
#define ICIDMLinkTransmitter2_SendLinkToIDM(This,bstrUrl,bstrReferer,bstrCookies,bstrData,bstrUser,bstrPassword,bstrLocalPath,bstrLocalFileName,lFlags) \
(This)->lpVtbl -> SendLinkToIDM(This,bstrUrl,bstrReferer,bstrCookies,bstrData,bstrUser,bstrPassword,bstrLocalPath,bstrLocalFileName,lFlags)
#define ICIDMLinkTransmitter2_SendLinkToIDM2(This,bstrUrl,bstrReferer,bstrCookies,bstrData,bstrUser,bstrPassword,bstrLocalPath,bstrLocalFileName,lFlags,reserved1,reserved2) \
(This)->lpVtbl -> SendLinkToIDM2(This,bstrUrl,bstrReferer,bstrCookies,bstrData,bstrUser,bstrPassword,bstrLocalPath,bstrLocalFileName,lFlags,reserved1,reserved2)
#define ICIDMLinkTransmitter2_SendLinksArray(This,location,pLinksArray) \
(This)->lpVtbl -> SendLinksArray(This,location,pLinksArray)
#endif /* COBJMACROS */
#endif /* C style interface */
HRESULT STDMETHODCALLTYPE ICIDMLinkTransmitter2_SendLinkToIDM2_Proxy(
ICIDMLinkTransmitter2 __RPC_FAR * This,
/* [in] */ BSTR bstrUrl,
/* [in] */ BSTR bstrReferer,
/* [in] */ BSTR bstrCookies,
/* [in] */ BSTR bstrData,
/* [in] */ BSTR bstrUser,
/* [in] */ BSTR bstrPassword,
/* [in] */ BSTR bstrLocalPath,
/* [in] */ BSTR bstrLocalFileName,
/* [in] */ long lFlags,
/* [in] */ VARIANT reserved1,
/* [in] */ VARIANT reserved2);
void __RPC_STUB ICIDMLinkTransmitter2_SendLinkToIDM2_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
HRESULT STDMETHODCALLTYPE ICIDMLinkTransmitter2_SendLinksArray_Proxy(
ICIDMLinkTransmitter2 __RPC_FAR * This,
/* [in] */ BSTR location,
/* [in] */ VARIANT __RPC_FAR *pLinksArray);
void __RPC_STUB ICIDMLinkTransmitter2_SendLinksArray_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __ICIDMLinkTransmitter2_INTERFACE_DEFINED__ */
#ifndef __IDManLib_LIBRARY_DEFINED__
#define __IDManLib_LIBRARY_DEFINED__
/* library IDManLib */
/* [helpstring][version][uuid] */
EXTERN_C const IID LIBID_IDManLib;
EXTERN_C const CLSID CLSID_CIDMLinkTransmitter;
#ifdef __cplusplus
class DECLSPEC_UUID("AC746233-E9D3-49CD-862F-068F7B7CCCA4")
CIDMLinkTransmitter;
#endif
#endif /* __IDManLib_LIBRARY_DEFINED__ */
/* Additional Prototypes for ALL interfaces */
unsigned long __RPC_USER BSTR_UserSize( unsigned long __RPC_FAR *, unsigned long , BSTR __RPC_FAR * );
unsigned char __RPC_FAR * __RPC_USER BSTR_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * );
unsigned char __RPC_FAR * __RPC_USER BSTR_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * );
void __RPC_USER BSTR_UserFree( unsigned long __RPC_FAR *, BSTR __RPC_FAR * );
unsigned long __RPC_USER VARIANT_UserSize( unsigned long __RPC_FAR *, unsigned long , VARIANT __RPC_FAR * );
unsigned char __RPC_FAR * __RPC_USER VARIANT_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, VARIANT __RPC_FAR * );
unsigned char __RPC_FAR * __RPC_USER VARIANT_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, VARIANT __RPC_FAR * );
void __RPC_USER VARIANT_UserFree( unsigned long __RPC_FAR *, VARIANT __RPC_FAR * );
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,53 @@
/* this file contains the actual definitions of */
/* the IIDs and CLSIDs */
/* link this file in with the server and any clients */
/* File created by MIDL compiler version 5.01.0164 */
/* at Mon Oct 13 07:34:24 2003
*/
/* Compiler settings for C:\users\sansan\testVersion\Downloader\IDManTypeInfo.idl:
Os (OptLev=s), W1, Zp8, env=Win32, ms_ext, c_ext
error checks: allocation ref bounds_check enum stub_data
*/
//@@MIDL_FILE_HEADING( )
#ifdef __cplusplus
extern "C"{
#endif
#ifndef __IID_DEFINED__
#define __IID_DEFINED__
typedef struct _IID
{
unsigned long x;
unsigned short s1;
unsigned short s2;
unsigned char c[8];
} IID;
#endif // __IID_DEFINED__
#ifndef CLSID_DEFINED
#define CLSID_DEFINED
typedef IID CLSID;
#endif // CLSID_DEFINED
const IID IID_ICIDMLinkTransmitter = {0x4BD46AAE,0xC51F,0x4BF7,{0x8B,0xC0,0x2E,0x86,0xE3,0x3D,0x18,0x73}};
const IID IID_ICIDMLinkTransmitter2 = {0x94D09862,0x1875,0x4FC9,{0xB4,0x34,0x91,0xCF,0x25,0xC8,0x40,0xA1}};
const IID LIBID_IDManLib = {0xECF21EAB,0x3AA8,0x4355,{0x82,0xBE,0xF7,0x77,0x99,0x00,0x01,0xDD}};
const CLSID CLSID_CIDMLinkTransmitter = {0xAC746233,0xE9D3,0x49CD,{0x86,0x2F,0x06,0x8F,0x7B,0x7C,0xCC,0xA4}};
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,104 @@
public void Download(int id)
{
// **************************************************
string strFileName =
string.Format("{0}.zip", id);
string strRootRelativePathName =
string.Format("~/App_Data/Files/{0}", strFileName);
string strPathName =
Server.MapPath(strRootRelativePathName);
if (System.IO.File.Exists(strPathName) == false)
{
return;
}
// **************************************************
System.IO.Stream oStream = null;
try
{
// Open the file
oStream =
new System.IO.FileStream
(path: strPathName,
mode: System.IO.FileMode.Open,
share: System.IO.FileShare.Read,
access: System.IO.FileAccess.Read);
// **************************************************
Response.Buffer = false;
// Setting the unknown [ContentType]
// will display the saving dialog for the user
Response.ContentType = "application/octet-stream";
// With setting the file name,
// in the saving dialog, user will see
// the [strFileName] name instead of [download]!
//Response.AddHeader("Content-Disposition", "attachment; filename=" + strFileName);
Response.AppendHeader("Content-Disposition", "attachment;size=" + new System.IO.FileInfo(strPathName).Length + ";filename=" + strFileName);
long lngFileLength = oStream.Length;
// Notify user (client) the total file length
Response.AddHeader("Content-Length", lngFileLength.ToString());
// **************************************************
// Total bytes that should be read
long lngDataToRead = lngFileLength;
// Read the bytes of file
while (lngDataToRead > 0)
{
// The below code is just for testing! So we commented it!
//System.Threading.Thread.Sleep(200);
// Verify that the client is connected or not?
if (Response.IsClientConnected)
{
// 8KB
int intBufferSize = 8 * 1024;
// Create buffer for reading [intBufferSize] bytes from file
byte[] bytBuffers =
new System.Byte[intBufferSize];
// Read the data and put it in the buffer.
int intTheBytesThatReallyHasBeenReadFromTheStream =
oStream.Read(buffer: bytBuffers, offset: 0, count: intBufferSize);
// Write the data from buffer to the current output stream.
Response.OutputStream.Write
(buffer: bytBuffers, offset: 0,
count: intTheBytesThatReallyHasBeenReadFromTheStream);
// Flush (Send) the data to output
// (Don't buffer in server's RAM!)
Response.Flush();
lngDataToRead =
lngDataToRead - intTheBytesThatReallyHasBeenReadFromTheStream;
}
else
{
// Prevent infinite loop if user disconnected!
lngDataToRead = -1;
}
}
}
catch { }
finally
{
if (oStream != null)
{
//Close the file.
oStream.Close();
oStream.Dispose();
oStream = null;
}
Response.Close();
}
}