IOCTL_PROCESSOR_INFORMATION and OpenNetCF

  • Thread starter Thread starter Randy Beckwith
  • Start date Start date
R

Randy Beckwith

Is IOCTL_PROCESSOR_INFORMATION / PROCESSOR_INFO no longer supported in
the OpenNetCF library? I ran across this article that said that it was
implemented in OpenNetCF. I browsed the help and searched the source
code but didn't find any reference to it.

Randy Beckwith



It's all already done in the OpenNETCF library. We did it (and
provided in
the source format) so that the others would be spared the guesswork.

http://www.opennetcf.org/winapi.asp
 
GetSystemInfo in Core.cs has it:

http://opennetcf.org/SourceBrowse/v...netPub/wwwroot/Source/OpenNETCF/Win32/Core.cs

--
Chris Tacke, eMVP
Co-Founder and Advisory Board Member
www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems
www.applieddata.net


Randy Beckwith said:
Is IOCTL_PROCESSOR_INFORMATION / PROCESSOR_INFO no longer supported in
the OpenNetCF library? I ran across this article that said that it was
implemented in OpenNetCF. I browsed the help and searched the source
code but didn't find any reference to it.

Randy Beckwith



It's all already done in the OpenNETCF library. We did it (and
provided in
the source format) so that the others would be spared the guesswork.

http://www.opennetcf.org/winapi.asp


Anderson Takemitsu Kubota said:
Hi!

I need to P/Invoke the following function:

public struct PROCESSOR_INFO
{
public ushort wVersion;
public byte[] szProcessCore;
public ushort wCoreRevision;
public byte[] szProcessorName;
public ushort wProcessorRevision;
public byte[] szCatalogNumber;
public byte[] szVendor;
public uint dwInstructionSet;
public uint dwClockSpeed;
}
public unsafe string GetProcessorInfo()
{
Int32 OutputBufferSize, BytesReturned;
BytesReturned = 0;
PROCESSOR_INFO pi;
int dwPlatformInfoCmd;
dwPlatformInfoCmd = 0;
int* iPtr = &dwPlatformInfoCmd;
IntPtr iPtrCtlCode = (IntPtr)iPtr;
Int32 buffersize = sizeof(PROCESSOR_INFO);
bool retVal = KernelIoControl(IOCTL_PROCESSOR_INFORMATION,
iPtrCtlCode,
4,
pi,
buffersize,
ref BytesReturned);
string strReturn = "";
string strAux;
return Convert.ToString(pi.szProcessCore)+ " -
"+Convert.ToString(pi.szProcessorName);
}

But I am getting the error:
Cannot take the address or size of a variable of a managed type
(PROCESSOR_INFO)
I believe that this problem is happening because I have the byte[] with a
non fixed lenght.
How could I solve this problem?

Thank you.

Anderson T. Kubota
 
While its true OpenNetCF has GetSystemInfo,
IOCTL_PROCESSOR_INFORMATION is not the same thing.
IOCTL_PROCESSOR_INFORMATION returns a PROCESSOR_INFO structure which
contains different information then GetSystemInfo:

typedef __PROCESSOR_INFO {
WORD wVersion;
WCHAR szProcessorCore[40];
WORD wCoreRevision;
WCHAR szProcessorName[40];
WORD wProcessorRevision;
WCAHR szCatalogNumber[100];
WCHAR szVendor[100];
DWORD dwInstructionSet;
DWORD dwClockSpeed;
}


Chris Tacke said:
GetSystemInfo in Core.cs has it:

http://opennetcf.org/SourceBrowse/v...netPub/wwwroot/Source/OpenNETCF/Win32/Core.cs

--
Chris Tacke, eMVP
Co-Founder and Advisory Board Member
www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems
www.applieddata.net


Randy Beckwith said:
Is IOCTL_PROCESSOR_INFORMATION / PROCESSOR_INFO no longer supported in
the OpenNetCF library? I ran across this article that said that it was
implemented in OpenNetCF. I browsed the help and searched the source
code but didn't find any reference to it.

Randy Beckwith



It's all already done in the OpenNETCF library. We did it (and
provided in
the source format) so that the others would be spared the guesswork.

http://www.opennetcf.org/winapi.asp


Anderson Takemitsu Kubota said:
Hi!

I need to P/Invoke the following function:

public struct PROCESSOR_INFO
{
public ushort wVersion;
public byte[] szProcessCore;
public ushort wCoreRevision;
public byte[] szProcessorName;
public ushort wProcessorRevision;
public byte[] szCatalogNumber;
public byte[] szVendor;
public uint dwInstructionSet;
public uint dwClockSpeed;
}
public unsafe string GetProcessorInfo()
{
Int32 OutputBufferSize, BytesReturned;
BytesReturned = 0;
PROCESSOR_INFO pi;
int dwPlatformInfoCmd;
dwPlatformInfoCmd = 0;
int* iPtr = &dwPlatformInfoCmd;
IntPtr iPtrCtlCode = (IntPtr)iPtr;
Int32 buffersize = sizeof(PROCESSOR_INFO);
bool retVal = KernelIoControl(IOCTL_PROCESSOR_INFORMATION,
iPtrCtlCode,
4,
pi,
buffersize,
ref BytesReturned);
string strReturn = "";
string strAux;
return Convert.ToString(pi.szProcessCore)+ " -
"+Convert.ToString(pi.szProcessorName);
}

But I am getting the error:
Cannot take the address or size of a variable of a managed type
(PROCESSOR_INFO)
I believe that this problem is happening because I have the byte[] with a
non fixed lenght.
How could I solve this problem?

Thank you.

Anderson T. Kubota
 
Back
Top