1) In MinGW-32/MinGW-64: compileSNFMultiDLL.cmd, buildSNFMultiDLL.cmd, buildSNFMultiTestDLL.cmd, buildvs2008SNFMultiImportLib.cmd (vs2008 prompt), run SNFMultiTest.exe, installSNFMultiLibrary.cmd. 2) Built/ran VS2008CPPSample, x32 and x64. 3) Built/ran VS2008CSSample, any, x32 and x64. 4) Built/ran VS2008VBSample, any, x32 and x64. 5) Ran BuildDistribution.cmd. This created the .zip file. git-svn-id: https://svn.microneil.com/svn/PKG-SNF-SDK-WIN/trunk@26 7d91e7c8-5a61-404e-b06a-95855fde9112master
#region DLL Imports | #region DLL Imports | ||||
// Location of SNFMulti.dll. | // Location of SNFMulti.dll. | ||||
const string SNFMULTI_DLL = "..\\..\\..\\64bitDll\\SNFMulti.dll"; // Set CPU type to "Any CPU" | |||||
//const string SNFMULTI_DLL = "..\\..\\..\\64bitDll\\SNFMulti.dll"; // Set CPU type to "Any CPU" | |||||
//const string SNFMULTI_DLL = "..\\..\\..\\..\\64bitDll\\SNFMulti.dll"; // Set CPU type to "x64 | //const string SNFMULTI_DLL = "..\\..\\..\\..\\64bitDll\\SNFMulti.dll"; // Set CPU type to "x64 | ||||
//const string SNFMULTI_DLL = "..\\..\\..\\..\\32bitDll\\SNFMulti.dll"; // Set CPU type to "x86" | |||||
const string SNFMULTI_DLL = "..\\..\\..\\..\\32bitDll\\SNFMulti.dll"; // Set CPU type to "x86" | |||||
// int setThrottle(int Threads); /* Set scan thread limit. */ | // int setThrottle(int Threads); /* Set scan thread limit. */ | ||||
[DllImport(SNFMULTI_DLL, CharSet = CharSet.Auto, EntryPoint = "setThrottle", CallingConvention = CallingConvention.Winapi)] | [DllImport(SNFMULTI_DLL, CharSet = CharSet.Auto, EntryPoint = "setThrottle", CallingConvention = CallingConvention.Winapi)] | ||||
// const string LicenseID = "licensid"; // SNF License ID can be passed | // const string LicenseID = "licensid"; // SNF License ID can be passed | ||||
// const string Authentication = "authenticationxx"; // directly or read from the | // const string Authentication = "authenticationxx"; // directly or read from the | ||||
// configuration. OEMs go direct! | // configuration. OEMs go direct! | ||||
const string ConfigurationPath = "..\\..\\snf_engine.xml"; // For "Any CPU" platform. | |||||
//const string ConfigurationPath = "..\\..\\..\\snf_engine.xml"; // For "x86" or "x64" platforms. | |||||
//const string ConfigurationPath = "..\\..\\snf_engine.xml"; // For "Any CPU" platform. | |||||
const string ConfigurationPath = "..\\..\\..\\snf_engine.xml"; // For "x86" or "x64" platforms. | |||||
const uint IPToTest = 0x0c22384e; // Same as IP 12.34.56.78 | const uint IPToTest = 0x0c22384e; // Same as IP 12.34.56.78 |
#region DLL Imports | #region DLL Imports | ||||
// Location of SNFMulti.dll. | // Location of SNFMulti.dll. | ||||
const string SNFMULTI_DLL = "..\\..\\..\\64bitDll\\SNFMulti.dll"; // Set CPU type to "Any CPU" | |||||
//const string SNFMULTI_DLL = "..\\..\\..\\64bitDll\\SNFMulti.dll"; // Set CPU type to "Any CPU" | |||||
//const string SNFMULTI_DLL = "..\\..\\..\\..\\64bitDll\\SNFMulti.dll"; // Set CPU type to "x64 | //const string SNFMULTI_DLL = "..\\..\\..\\..\\64bitDll\\SNFMulti.dll"; // Set CPU type to "x64 | ||||
//const string SNFMULTI_DLL = "..\\..\\..\\..\\32bitDll\\SNFMulti.dll"; // Set CPU type to "x86" | |||||
const string SNFMULTI_DLL = "..\\..\\..\\..\\32bitDll\\SNFMulti.dll"; // Set CPU type to "x86" | |||||
// int setThrottle(int Threads); /* Set scan thread limit. */ | // int setThrottle(int Threads); /* Set scan thread limit. */ | ||||
[DllImport(SNFMULTI_DLL, CharSet = CharSet.Auto, EntryPoint = "setThrottle", CallingConvention = CallingConvention.Winapi)] | [DllImport(SNFMULTI_DLL, CharSet = CharSet.Auto, EntryPoint = "setThrottle", CallingConvention = CallingConvention.Winapi)] | ||||
// const string LicenseID = "licensid"; // SNF License ID can be passed | // const string LicenseID = "licensid"; // SNF License ID can be passed | ||||
// const string Authentication = "authenticationxx"; // directly or read from the | // const string Authentication = "authenticationxx"; // directly or read from the | ||||
// configuration. OEMs go direct! | // configuration. OEMs go direct! | ||||
const string ConfigurationPath = "..\\..\\snf_engine.xml"; // For "Any CPU" platform. | |||||
//const string ConfigurationPath = "..\\..\\..\\snf_engine.xml"; // For "x86" or "x64" platforms. | |||||
//const string ConfigurationPath = "..\\..\\snf_engine.xml"; // For "Any CPU" platform. | |||||
const string ConfigurationPath = "..\\..\\..\\snf_engine.xml"; // For "x86" or "x64" platforms. | |||||
const uint IPToTest = 0x0c22384e; // Same as IP 12.34.56.78 | const uint IPToTest = 0x0c22384e; // Same as IP 12.34.56.78 |
//// Configuratino Data //////////////////////////////////////////////////////// | //// Configuratino Data //////////////////////////////////////////////////////// | ||||
char* newCStringBuffer(size_t requestedSize) { | |||||
const char NullTerminator = 0; | |||||
size_t safeSize = requestedSize + 1; | |||||
char* theBufferPointer = new char[safeSize]; | |||||
theBufferPointer[requestedSize] = NullTerminator; | |||||
return theBufferPointer; | |||||
} | |||||
ConfigurationData::ConfigurationData(const char* Data, int Length) : // Raw constructor from buffer. | ConfigurationData::ConfigurationData(const char* Data, int Length) : // Raw constructor from buffer. | ||||
myBufferSize(Length), // and it's length. | myBufferSize(Length), // and it's length. | ||||
myIndex(0), // Our Index is zero | myIndex(0), // Our Index is zero | ||||
myLine(1) { // We start on line 1 | myLine(1) { // We start on line 1 | ||||
myDataBuffer = new char[myBufferSize]; // Allocate a buffer. | |||||
myDataBuffer = newCStringBuffer(myBufferSize); // Allocate a buffer. | |||||
memcpy(myDataBuffer, Data, myBufferSize); // Copy the data. | memcpy(myDataBuffer, Data, myBufferSize); // Copy the data. | ||||
} | } | ||||
ifstream CFGFile(FileName); // Open the file. | ifstream CFGFile(FileName); // Open the file. | ||||
CFGFile.seekg(0,ios::end); // Seek to the end | CFGFile.seekg(0,ios::end); // Seek to the end | ||||
myBufferSize = CFGFile.tellg(); // to find out what size it is. | myBufferSize = CFGFile.tellg(); // to find out what size it is. | ||||
myDataBuffer = new char[myBufferSize]; // Make a new buffer the right size. | |||||
myDataBuffer = newCStringBuffer(myBufferSize); // Make a new buffer the right size. | |||||
CFGFile.seekg(0,ios::beg); // Seek to the beginning and | CFGFile.seekg(0,ios::beg); // Seek to the beginning and | ||||
CFGFile.read(myDataBuffer, myBufferSize); // read the file into the buffer. | CFGFile.read(myDataBuffer, myBufferSize); // read the file into the buffer. | ||||
if(CFGFile.bad()) { // If the read failed, we're unusable! | if(CFGFile.bad()) { // If the read failed, we're unusable! | ||||
ifstream CFGFile(FileName.c_str()); // Open the file. | ifstream CFGFile(FileName.c_str()); // Open the file. | ||||
CFGFile.seekg(0,ios::end); // Seek to the end | CFGFile.seekg(0,ios::end); // Seek to the end | ||||
myBufferSize = CFGFile.tellg(); // to find out what size it is. | myBufferSize = CFGFile.tellg(); // to find out what size it is. | ||||
myDataBuffer = new char[myBufferSize]; // Make a new buffer the right size. | |||||
myDataBuffer = newCStringBuffer(myBufferSize); // Make a new buffer the right size. | |||||
CFGFile.seekg(0,ios::beg); // Seek to the beginning and | CFGFile.seekg(0,ios::beg); // Seek to the beginning and | ||||
CFGFile.read(myDataBuffer, myBufferSize); // read the file into the buffer. | CFGFile.read(myDataBuffer, myBufferSize); // read the file into the buffer. | ||||
if(CFGFile.bad()) { // If the read failed, we're unusable! | if(CFGFile.bad()) { // If the read failed, we're unusable! |