本人不懂C++,懂C++ 的帮忙看看 RRS feed

  • 问题

  • 我想把下面这段代码封装成一个DLL,让后让C#调用,问题是出在我不会c++不知道如何封装,请各位帮一下忙~! 麻烦详细代码完整点不然我又看不懂

    #include <windows.h>
    #include <iostream>
    #include <string>
    using namespace std;
    //Creating a function to obtain the CPUID
    //string GetCpuID()
    string GetCpuID()
    	//Initialize used variables
    	char SysType[13]; //Array consisting of 13 single bytes/characters
    	string CpuID; //The string that will be used to add all the characters to
    	//Starting coding in assembly language
    		//Execute CPUID with EAX = 0 to get the CPU producer
    		XOR EAX, EAX
    		//MOV EBX to EAX and get the characters one by one by using shift out right bitwise operation.
    		MOV EAX, EBX
    		MOV SysType[0], al
    		MOV SysType[1], ah
    		SHR EAX, 16
    		MOV SysType[2], al
    		MOV SysType[3], ah
    		//Get the second part the same way but these values are stored in EDX
    		MOV EAX, EDX
    		MOV SysType[4], al
    		MOV SysType[5], ah
    		SHR EAX, 16
    		MOV SysType[6], al
    		MOV SysType[7], ah
    		//Get the third part
    		MOV EAX, ECX
    		MOV SysType[8], al
    		MOV SysType[9], ah
    		SHR EAX, 16
    		MOV SysType[10], al
    		MOV SysType[11], ah
    		MOV SysType[12], 00
    	return CpuID;

    2011年5月23日 16:46