Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning a string from an explicit DLL function call.

Status
Not open for further replies.

dxd

Technical User
Jan 27, 2000
474
US
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]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top