Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit

  • Loading branch information...
commit c68597b89ac2f37bc3ec8b684c82631f4c9011c7 0 parents
@richard-sim authored
22 mpc05ls.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 11
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpc05ls", "mpc05ls\mpc05ls.vcxproj", "{B4028DAE-D36D-9639-F85F-054F6E89303B}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B4028DAE-D36D-9639-F85F-054F6E89303B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B4028DAE-D36D-9639-F85F-054F6E89303B}.Debug|Win32.Build.0 = Debug|Win32
+ {B4028DAE-D36D-9639-F85F-054F6E89303B}.Debug|Win32.Deploy.0 = Debug|Win32
+ {B4028DAE-D36D-9639-F85F-054F6E89303B}.Release|Win32.ActiveCfg = Release|Win32
+ {B4028DAE-D36D-9639-F85F-054F6E89303B}.Release|Win32.Build.0 = Release|Win32
+ {B4028DAE-D36D-9639-F85F-054F6E89303B}.Release|Win32.Deploy.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
19 mpc05ls/dllmain.cpp
@@ -0,0 +1,19 @@
+// dllmain.cpp : Defines the entry point for the DLL application.
+#include "stdafx.h"
+
+BOOL APIENTRY DllMain( HMODULE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
573 mpc05ls/mpc05ls.cpp
@@ -0,0 +1,573 @@
+// mpc05ls.cpp : Defines the exported functions for the DLL application.
+//
+
+#include "stdafx.h"
+#include "mpc05ls.h"
+#include <stdio.h>
+
+
+typedef int (MPC05LS_CC *tM05_init_board)();
+typedef int (MPC05LS_CC *tM05_on_comm)(int ch);
+typedef int (MPC05LS_CC *tM05_open_link)(int ch, int rate);
+typedef int (MPC05LS_CC *tM05_close_file)();
+typedef int (MPC05LS_CC *tM05_close_link)(int ch);
+typedef int (MPC05LS_CC *tM05_compile_work_file)(char* filename);
+typedef int (MPC05LS_CC *tM05_create_file)(PBYTE filename, DWORD filelenbytes);
+typedef int (MPC05LS_CC *tM05_del_file)(int FileID);
+typedef int (MPC05LS_CC *tM05_del_all_file)();
+typedef int (MPC05LS_CC *tM05_download_work_file)(char* filename);
+typedef int (MPC05LS_CC *tM05_get_file_num)(int* CurFileID, int* FileNum);
+typedef int (MPC05LS_CC *tM05_open_file)(BYTE fileID, PDWORD filelen, PBYTE filename);
+typedef int (MPC05LS_CC *tM05_set_work_file)(char* file);
+typedef int (MPC05LS_CC *tM05_send_cmd)(DWORD dwDataLenDword, PDWORD pdwData);
+typedef int (MPC05LS_CC *tM05_control_func)(int FuncID);
+typedef int (MPC05LS_CC *tM05_get_board_info)(int* info);
+typedef DWORD (MPC05LS_CC *tM05_get_board_ver)();
+typedef DWORD (MPC05LS_CC *tM05_get_hdw_ver)();
+typedef DWORD (MPC05LS_CC *tM05_get_lib_ver)();
+typedef int (MPC05LS_CC *tM05_GetCardNumber)(int foofoo);
+typedef int (MPC05LS_CC *tM05_WriteDogNumber)(int foofoo);
+typedef int (MPC05LS_CC *tM05_ReadDogNumber)(int foofoo);
+typedef int (MPC05LS_CC *tM05_GetCanUseTime)();
+typedef int (MPC05LS_CC *tM05_SetCanUseTime)(int foofoo);
+typedef int (MPC05LS_CC *tM05_GetHasUseTime)();
+typedef int (MPC05LS_CC *tM05_SetHasUseTime)(int foofoo);
+typedef int (MPC05LS_CC *tM05_get_pre_worktime)(int foo);
+typedef int (MPC05LS_CC *tM05_write_data_to_flash)(int foo, int bar, int doo);
+typedef int (MPC05LS_CC *tM05_read_data_from_flash)(int foo, int bar, int doo);
+typedef int (MPC05LS_CC *tM05_erase_flash)(int foo, int bar);
+
+
+struct tMPC05LS
+{
+ HMODULE hDLL;
+ FILE* hLog;
+
+ tM05_init_board M05_init_board;
+ tM05_on_comm M05_on_comm;
+ tM05_open_link M05_open_link;
+ tM05_close_file M05_close_file;
+ tM05_close_link M05_close_link;
+ tM05_compile_work_file M05_compile_work_file;
+ tM05_create_file M05_create_file;
+ tM05_del_file M05_del_file;
+ tM05_del_all_file M05_del_all_file;
+ tM05_download_work_file M05_download_work_file;
+ tM05_get_file_num M05_get_file_num;
+ tM05_open_file M05_open_file;
+ tM05_set_work_file M05_set_work_file;
+ tM05_send_cmd M05_send_cmd;
+ tM05_control_func M05_control_func;
+ tM05_get_board_info M05_get_board_info;
+ tM05_get_board_ver M05_get_board_ver;
+ tM05_get_hdw_ver M05_get_hdw_ver;
+ tM05_get_lib_ver M05_get_lib_ver;
+ tM05_GetCardNumber M05_GetCardNumber;
+ tM05_WriteDogNumber M05_WriteDogNumber;
+ tM05_ReadDogNumber M05_ReadDogNumber;
+ tM05_GetCanUseTime M05_GetCanUseTime;
+ tM05_SetCanUseTime M05_SetCanUseTime;
+ tM05_GetHasUseTime M05_GetHasUseTime;
+ tM05_SetHasUseTime M05_SetHasUseTime;
+ tM05_get_pre_worktime M05_get_pre_worktime;
+ tM05_write_data_to_flash M05_write_data_to_flash;
+ tM05_read_data_from_flash M05_read_data_from_flash;
+ tM05_erase_flash M05_erase_flash;
+};
+
+
+tMPC05LS g_DLL = {NULL};
+
+
+void Log(const char* fmt, ...)
+{
+ if (!g_DLL.hLog)
+ return;
+
+ const int bufferSize = 1024;
+ char logEntry[bufferSize];
+
+ va_list args;
+ va_start(args, fmt);
+
+ vsnprintf_s(logEntry, bufferSize, bufferSize-1, fmt, args);
+
+ fprintf(g_DLL.hLog, "%s\n", logEntry);
+ fflush(g_DLL.hLog);
+}
+
+
+void InitDLL()
+{
+ if (g_DLL.hDLL)
+ return;
+
+ if (fopen_s(&g_DLL.hLog, "C:\\Temp\\mpc05ls.log", "wt") != 0)
+ {
+ MessageBoxA(NULL, "Could not open activity log for writing!", "Error", MB_ICONERROR);
+ }
+
+ Log("Loading module to shadow...");
+ g_DLL.hDLL = LoadLibraryA("mpc05lsX.dll");
+ if (!g_DLL.hDLL)
+ {
+ Log("Could not load module!");
+ MessageBoxA(NULL, "Could not load original DLL!", "Error", MB_ICONERROR);
+ return;
+ }
+
+ Log("Looking up function addresses...");
+
+ g_DLL.M05_init_board = (tM05_init_board )GetProcAddress(g_DLL.hDLL, "M05_init_board");
+ g_DLL.M05_on_comm = (tM05_on_comm )GetProcAddress(g_DLL.hDLL, "M05_on_comm");
+ g_DLL.M05_open_link = (tM05_open_link )GetProcAddress(g_DLL.hDLL, "M05_open_link");
+ g_DLL.M05_close_file = (tM05_close_file )GetProcAddress(g_DLL.hDLL, "M05_close_file");
+ g_DLL.M05_close_link = (tM05_close_link )GetProcAddress(g_DLL.hDLL, "M05_close_link");
+ g_DLL.M05_compile_work_file = (tM05_compile_work_file )GetProcAddress(g_DLL.hDLL, "M05_compile_work_file");
+ g_DLL.M05_create_file = (tM05_create_file )GetProcAddress(g_DLL.hDLL, "M05_create_file");
+ g_DLL.M05_del_file = (tM05_del_file )GetProcAddress(g_DLL.hDLL, "M05_del_file");
+ g_DLL.M05_del_all_file = (tM05_del_all_file )GetProcAddress(g_DLL.hDLL, "M05_del_all_file");
+ g_DLL.M05_download_work_file = (tM05_download_work_file )GetProcAddress(g_DLL.hDLL, "M05_download_work_file");
+ g_DLL.M05_get_file_num = (tM05_get_file_num )GetProcAddress(g_DLL.hDLL, "M05_get_file_num");
+ g_DLL.M05_open_file = (tM05_open_file )GetProcAddress(g_DLL.hDLL, "M05_open_file");
+ g_DLL.M05_set_work_file = (tM05_set_work_file )GetProcAddress(g_DLL.hDLL, "M05_set_work_file");
+ g_DLL.M05_send_cmd = (tM05_send_cmd )GetProcAddress(g_DLL.hDLL, "M05_send_cmd");
+ g_DLL.M05_control_func = (tM05_control_func )GetProcAddress(g_DLL.hDLL, "M05_control_func");
+ g_DLL.M05_get_board_info = (tM05_get_board_info )GetProcAddress(g_DLL.hDLL, "M05_get_board_info");
+ g_DLL.M05_get_board_ver = (tM05_get_board_ver )GetProcAddress(g_DLL.hDLL, "M05_get_board_ver");
+ g_DLL.M05_get_hdw_ver = (tM05_get_hdw_ver )GetProcAddress(g_DLL.hDLL, "M05_get_hdw_ver");
+ g_DLL.M05_get_lib_ver = (tM05_get_lib_ver )GetProcAddress(g_DLL.hDLL, "M05_get_lib_ver");
+ g_DLL.M05_GetCardNumber = (tM05_GetCardNumber )GetProcAddress(g_DLL.hDLL, "M05_GetCardNumber");
+ g_DLL.M05_WriteDogNumber = (tM05_WriteDogNumber )GetProcAddress(g_DLL.hDLL, "M05_WriteDogNumber");
+ g_DLL.M05_ReadDogNumber = (tM05_ReadDogNumber )GetProcAddress(g_DLL.hDLL, "M05_ReadDogNumber");
+ g_DLL.M05_GetCanUseTime = (tM05_GetCanUseTime )GetProcAddress(g_DLL.hDLL, "M05_GetCanUseTime");
+ g_DLL.M05_SetCanUseTime = (tM05_SetCanUseTime )GetProcAddress(g_DLL.hDLL, "M05_SetCanUseTime");
+ g_DLL.M05_GetHasUseTime = (tM05_GetHasUseTime )GetProcAddress(g_DLL.hDLL, "M05_GetHasUseTime");
+ g_DLL.M05_SetHasUseTime = (tM05_SetHasUseTime )GetProcAddress(g_DLL.hDLL, "M05_SetHasUseTime");
+ g_DLL.M05_get_pre_worktime = (tM05_get_pre_worktime )GetProcAddress(g_DLL.hDLL, "M05_get_pre_worktime");
+ g_DLL.M05_write_data_to_flash = (tM05_write_data_to_flash )GetProcAddress(g_DLL.hDLL, "M05_write_data_to_flash");
+ g_DLL.M05_read_data_from_flash = (tM05_read_data_from_flash)GetProcAddress(g_DLL.hDLL, "M05_read_data_from_flash");
+ g_DLL.M05_erase_flash = (tM05_erase_flash )GetProcAddress(g_DLL.hDLL, "M05_erase_flash");
+
+ Log("Function address lookup complete.");
+}
+
+
+extern "C"
+{
+ int MPC05LS_CC M05_init_board()
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_init_board)
+ return (*g_DLL.M05_init_board)();
+ return -1;
+ }
+
+ int MPC05LS_CC M05_on_comm(int ch)
+ {
+ InitDLL();
+
+ Log("%s(%d)", __FUNCTION__, ch);
+ if (g_DLL.M05_on_comm)
+ {
+ int res = (*g_DLL.M05_on_comm)(ch);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_open_link(int ch, int rate)
+ {
+ InitDLL();
+
+ Log("%s(%d, %d)", __FUNCTION__, ch, rate);
+ if (g_DLL.M05_open_link)
+ {
+ int res = (*g_DLL.M05_open_link)(ch, rate);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_close_file()
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_close_file)
+ {
+ int res = (*g_DLL.M05_close_file)();
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_close_link(int ch)
+ {
+ InitDLL();
+
+ Log("%s(%d)", __FUNCTION__, ch);
+ if (g_DLL.M05_close_link)
+ {
+ int res = (*g_DLL.M05_close_link)(ch);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_compile_work_file(char* filename)
+ {
+ InitDLL();
+
+ Log("%s(%s)", __FUNCTION__, filename);
+ if (g_DLL.M05_compile_work_file)
+ {
+ int res = (*g_DLL.M05_compile_work_file)(filename);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_create_file(PBYTE filename, DWORD filelenbytes)
+ {
+ InitDLL();
+
+ Log("%s(%s, %u)", __FUNCTION__, filename, filelenbytes);
+ if (g_DLL.M05_create_file)
+ {
+ int res = (*g_DLL.M05_create_file)(filename, filelenbytes);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_del_file(int FileID)
+ {
+ InitDLL();
+
+ Log("%s(%d)", __FUNCTION__, FileID);
+ if (g_DLL.M05_del_file)
+ {
+ int res = (*g_DLL.M05_del_file)(FileID);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_del_all_file()
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_del_all_file)
+ {
+ int res = (*g_DLL.M05_del_all_file)();
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_download_work_file(char* filename)
+ {
+ InitDLL();
+
+ Log("%s(%s)", __FUNCTION__, filename);
+ if (g_DLL.M05_download_work_file)
+ {
+ int res = (*g_DLL.M05_download_work_file)(filename);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_get_file_num(int* CurFileID, int* FileNum)
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_get_file_num)
+ {
+ int res = (*g_DLL.M05_get_file_num)(CurFileID, FileNum);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_open_file(BYTE fileID, PDWORD filelen, PBYTE filename)
+ {
+ InitDLL();
+
+ Log("%s(%d, %s)", __FUNCTION__, fileID, filename);
+ if (g_DLL.M05_open_file)
+ {
+ int res = (*g_DLL.M05_open_file)(fileID, filelen, filename);
+ Log("\tResult: %d (%u, %s)", res, *filelen, filename);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_set_work_file(char* file)
+ {
+ InitDLL();
+
+ Log("%s(%s)", __FUNCTION__, file);
+ if (g_DLL.M05_set_work_file)
+ {
+ int res = (*g_DLL.M05_set_work_file)(file);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_send_cmd(DWORD dwDataLenDword, PDWORD pdwData)
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_send_cmd)
+ {
+ int res = (*g_DLL.M05_send_cmd)(dwDataLenDword, pdwData);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_control_func(int FuncID)
+ {
+ InitDLL();
+
+ Log("%s(%d)", __FUNCTION__, FuncID);
+ if (g_DLL.M05_control_func)
+ {
+ int res = (*g_DLL.M05_control_func)(FuncID);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_get_board_info(int* info)
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_get_board_info)
+ {
+ int res = (*g_DLL.M05_get_board_info)(info);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ DWORD MPC05LS_CC M05_get_board_ver()
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_get_board_ver)
+ {
+ DWORD res = (*g_DLL.M05_get_board_ver)();
+ Log("\tResult: %u", res);
+ return res;
+ }
+ return ~0u;
+ }
+
+ DWORD MPC05LS_CC M05_get_hdw_ver()
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_get_hdw_ver)
+ {
+ DWORD res = (*g_DLL.M05_get_hdw_ver)();
+ Log("\tResult: %u", res);
+ return res;
+ }
+ return ~0u;
+ }
+
+ DWORD MPC05LS_CC M05_get_lib_ver()
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_get_lib_ver)
+ {
+ DWORD res = (*g_DLL.M05_get_lib_ver)();
+ Log("\tResult: %u", res);
+ return res;
+ }
+ return ~0u;
+ }
+
+ int MPC05LS_CC M05_GetCardNumber(int foofoo)
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_GetCardNumber)
+ {
+ int res = (*g_DLL.M05_GetCardNumber)(foofoo);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_WriteDogNumber(int foofoo)
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_WriteDogNumber)
+ {
+ int res = (*g_DLL.M05_WriteDogNumber)(foofoo);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_ReadDogNumber(int foofoo)
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_ReadDogNumber)
+ {
+ int res = (*g_DLL.M05_ReadDogNumber)(foofoo);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_GetCanUseTime()
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_GetCanUseTime)
+ {
+ int res = (*g_DLL.M05_GetCanUseTime)();
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_SetCanUseTime(int foofoo)
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_SetCanUseTime)
+ {
+ int res = (*g_DLL.M05_SetCanUseTime)(foofoo);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_GetHasUseTime()
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_GetHasUseTime)
+ {
+ int res = (*g_DLL.M05_GetHasUseTime)();
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_SetHasUseTime(int foofoo)
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_SetHasUseTime)
+ {
+ int res = (*g_DLL.M05_SetHasUseTime)(foofoo);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_get_pre_worktime(int foo)
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_get_pre_worktime)
+ {
+ int res = (*g_DLL.M05_get_pre_worktime)(foo);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_write_data_to_flash(int foo, int bar, int doo)
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_write_data_to_flash)
+ {
+ int res = (*g_DLL.M05_write_data_to_flash)(foo, bar, doo);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_read_data_from_flash(int foo, int bar, int doo)
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_read_data_from_flash)
+ {
+ int res = (*g_DLL.M05_read_data_from_flash)(foo, bar, doo);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+
+ int MPC05LS_CC M05_erase_flash(int foo, int bar)
+ {
+ InitDLL();
+
+ Log(__FUNCTION__);
+ if (g_DLL.M05_erase_flash)
+ {
+ int res = (*g_DLL.M05_erase_flash)(foo, bar);
+ Log("\tResult: %d", res);
+ return res;
+ }
+ return -1;
+ }
+}
33 mpc05ls/mpc05ls.def
@@ -0,0 +1,33 @@
+LIBRARY
+
+EXPORTS
+ M05_init_board=_M05_init_board@0
+ M05_on_comm=_M05_on_comm@4
+ M05_open_link=_M05_open_link@8
+ M05_close_file=_M05_close_file@0
+ M05_close_link=_M05_close_link@4
+ M05_compile_work_file=_M05_compile_work_file@4
+ M05_create_file=_M05_create_file@8
+ M05_del_file=_M05_del_file@4
+ M05_del_all_file=_M05_del_all_file@0
+ M05_download_work_file=_M05_download_work_file@4
+ M05_get_file_num=_M05_get_file_num@8
+ M05_open_file=_M05_open_file@12
+ M05_set_work_file=_M05_set_work_file@4
+ M05_send_cmd=_M05_send_cmd@8
+ M05_control_func=_M05_control_func@4
+ M05_get_board_info=_M05_get_board_info@4
+ M05_get_board_ver=_M05_get_board_ver@0
+ M05_get_hdw_ver=_M05_get_hdw_ver@0
+ M05_get_lib_ver=_M05_get_lib_ver@0
+ M05_GetCardNumber=_M05_GetCardNumber@4
+ M05_WriteDogNumber=_M05_WriteDogNumber@4
+ M05_ReadDogNumber=_M05_ReadDogNumber@4
+ M05_GetCanUseTime=_M05_GetCanUseTime@0
+ M05_SetCanUseTime=_M05_SetCanUseTime@4
+ M05_GetHasUseTime=_M05_GetHasUseTime@0
+ M05_SetHasUseTime=_M05_SetHasUseTime@4
+ M05_get_pre_worktime=_M05_get_pre_worktime@4
+ M05_write_data_to_flash=_M05_write_data_to_flash@12
+ M05_read_data_from_flash=_M05_read_data_from_flash@12
+ M05_erase_flash=_M05_erase_flash@8
51 mpc05ls/mpc05ls.h
@@ -0,0 +1,51 @@
+// The following ifdef block is the standard way of creating macros which make exporting
+// from a DLL simpler. All files within this DLL are compiled with the MPC05LS_EXPORTS
+// symbol defined on the command line. This symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see
+// MPC05LS_API functions as being imported from a DLL, whereas this DLL sees symbols
+// defined with this macro as being exported.
+#ifdef MPC05LS_EXPORTS
+#define MPC05LS_API __declspec(dllexport)
+#else
+#define MPC05LS_API __declspec(dllimport)
+#endif
+
+#define MPC05LS_CC WINAPI
+
+#ifdef __cplusplus
+extern "C"
+#endif
+{
+ MPC05LS_API int MPC05LS_CC M05_init_board();
+ MPC05LS_API int MPC05LS_CC M05_on_comm(int ch);
+ MPC05LS_API int MPC05LS_CC M05_open_link(int ch, int rate);
+ MPC05LS_API int MPC05LS_CC M05_close_file();
+ MPC05LS_API int MPC05LS_CC M05_close_link(int ch);
+ MPC05LS_API int MPC05LS_CC M05_compile_work_file(char* filename);
+ MPC05LS_API int MPC05LS_CC M05_create_file(PBYTE filename, DWORD filelenbytes);
+ MPC05LS_API int MPC05LS_CC M05_del_file(int FileID);
+ MPC05LS_API int MPC05LS_CC M05_del_all_file();
+ MPC05LS_API int MPC05LS_CC M05_download_work_file(char* filename);
+ MPC05LS_API int MPC05LS_CC M05_get_file_num(int* CurFileID, int* FileNum);
+ MPC05LS_API int MPC05LS_CC M05_open_file(BYTE fileID, PDWORD filelen, PBYTE filename);
+ MPC05LS_API int MPC05LS_CC M05_set_work_file(char* file);
+ MPC05LS_API int MPC05LS_CC M05_send_cmd(DWORD dwDataLenDword, PDWORD pdwData);
+ MPC05LS_API int MPC05LS_CC M05_control_func(int FuncID);
+ MPC05LS_API int MPC05LS_CC M05_get_board_info(int* info);
+ MPC05LS_API DWORD MPC05LS_CC M05_get_board_ver();
+ MPC05LS_API DWORD MPC05LS_CC M05_get_hdw_ver();
+ MPC05LS_API DWORD MPC05LS_CC M05_get_lib_ver();
+ MPC05LS_API int MPC05LS_CC M05_GetCardNumber(int foofoo);
+ MPC05LS_API int MPC05LS_CC M05_WriteDogNumber(int foofoo);
+ MPC05LS_API int MPC05LS_CC M05_ReadDogNumber(int foofoo);
+ MPC05LS_API int MPC05LS_CC M05_GetCanUseTime();
+ MPC05LS_API int MPC05LS_CC M05_SetCanUseTime(int foofoo);
+ MPC05LS_API int MPC05LS_CC M05_GetHasUseTime();
+ MPC05LS_API int MPC05LS_CC M05_SetHasUseTime(int foofoo);
+ MPC05LS_API int MPC05LS_CC M05_get_pre_worktime(int foo);
+ MPC05LS_API int MPC05LS_CC M05_write_data_to_flash(int foo, int bar, int doo);
+ MPC05LS_API int MPC05LS_CC M05_read_data_from_flash(int foo, int bar, int doo);
+ MPC05LS_API int MPC05LS_CC M05_erase_flash(int foo, int bar);
+#ifdef __cplusplus
+}
+#endif
106 mpc05ls/mpc05ls.vcxproj
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and '$(VisualStudioVersion)' == ''">$(VCTargetsPath11)</VCTargetsPath>
+ </PropertyGroup>
+ <PropertyGroup Label="Globals">
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>mpc05ls</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v110</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MPC05LS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ModuleDefinitionFile>mpc05ls.def</ModuleDefinitionFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MPC05LS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <ModuleDefinitionFile>mpc05ls.def</ModuleDefinitionFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="mpc05ls.h" />
+ <ClInclude Include="stdafx.h" />
+ <ClInclude Include="targetver.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="dllmain.cpp">
+ <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ </PrecompiledHeader>
+ <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ </PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="mpc05ls.cpp" />
+ <ClCompile Include="stdafx.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="mpc05ls.def" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
44 mpc05ls/mpc05ls.vcxproj.filters
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="stdafx.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="targetver.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="mpc05ls.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="stdafx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="mpc05ls.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dllmain.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="mpc05ls.def">
+ <Filter>Source Files</Filter>
+ </None>
+ </ItemGroup>
+</Project>
8 mpc05ls/stdafx.cpp
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// mpc05ls.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
16 mpc05ls/stdafx.h
@@ -0,0 +1,16 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#include "targetver.h"
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+// Windows Header Files:
+#include <windows.h>
+
+
+
+// TODO: reference additional headers your program requires here
8 mpc05ls/targetver.h
@@ -0,0 +1,8 @@
+#pragma once
+
+// Including SDKDDKVer.h defines the highest available Windows platform.
+
+// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
+// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
+
+#include <SDKDDKVer.h>
Please sign in to comment.
Something went wrong with that request. Please try again.