Hi everyone,
I am currently working on a project used to print the computer model information. I am having a problem trying to return a char string from a DLL. The function, as it is originally works fine. The function will compare a pre-defined string to pointer to a memory location successfully.
What I am wanting to do is enhance this function to return the actual model info instead of just success.
Below is the DLL function in question. Specifically, I am trying to find out how to alter this function return the model name and then how to get the information to my exe to display.
extern "C"
short IsWorkstation()
{
#define PROFWORK "Professional Workstation"
short RetCode = FALSE;
DWORD dwAddress;
if (GetSITAddress(dwAddress) == ERROR_SUCCESS)
{
DWORD dwProductNameRecordAddr = FindSITKey(dwAddress,0x10);
if (dwProductNameRecordAddr) //!= 0
{
BYTE recordsize = 0;
if (ReadPhysMem(dwProductNameRecordAddr+0x01,sizeof(BYTE),&recordsize) == sizeof(BYTE)) //Record Size
{
LPTSTR pProductName = new char[recordsize] ;
if (ReadPhysMem(dwProductNameRecordAddr+0x02,(recordsize),pProductName) == recordsize)
{
//
// need check for "Professional Workstation" string
//
RetCode = (short)!strncmp( pProductName, PROFWORK, strlen(PROFWORK)) ;
}
delete pProductName ;
}
}
}
return RetCode;
}
Thanks!!
[sig]<p>Doug<br><a href=mailto:dxd_2000@yahoo.com>dxd_2000@yahoo.com</a><br><a href= > </a><br> [/sig]
I am currently working on a project used to print the computer model information. I am having a problem trying to return a char string from a DLL. The function, as it is originally works fine. The function will compare a pre-defined string to pointer to a memory location successfully.
What I am wanting to do is enhance this function to return the actual model info instead of just success.
Below is the DLL function in question. Specifically, I am trying to find out how to alter this function return the model name and then how to get the information to my exe to display.
extern "C"
short IsWorkstation()
{
#define PROFWORK "Professional Workstation"
short RetCode = FALSE;
DWORD dwAddress;
if (GetSITAddress(dwAddress) == ERROR_SUCCESS)
{
DWORD dwProductNameRecordAddr = FindSITKey(dwAddress,0x10);
if (dwProductNameRecordAddr) //!= 0
{
BYTE recordsize = 0;
if (ReadPhysMem(dwProductNameRecordAddr+0x01,sizeof(BYTE),&recordsize) == sizeof(BYTE)) //Record Size
{
LPTSTR pProductName = new char[recordsize] ;
if (ReadPhysMem(dwProductNameRecordAddr+0x02,(recordsize),pProductName) == recordsize)
{
//
// need check for "Professional Workstation" string
//
RetCode = (short)!strncmp( pProductName, PROFWORK, strlen(PROFWORK)) ;
}
delete pProductName ;
}
}
}
return RetCode;
}
Thanks!!
[sig]<p>Doug<br><a href=mailto:dxd_2000@yahoo.com>dxd_2000@yahoo.com</a><br><a href= > </a><br> [/sig]