/* class SysStatuswin32 for IE browsers uses J/Direct to access kernel32.dll functions to read current win32 system status parameters. Requires compilation with MS jvc compiler. M. Gallant 11/07/2001 */ import java.awt.*; import com.ms.security.*; import com.ms.wfc.util.*; public class SysStatuswin32 extends java.applet.Applet { private Label l0 = new Label("--- SYSTEM_INFO win32 struct properties ---") ; private Label l1 = new Label("ProcessorArchitecture: -------------------------------------------- ") ; private Label l2 = new Label("PageSize: -------------------------------------------- ") ;; private Label l3 = new Label("MinApplicationAddress: -------------------------------------------- ") ; private Label l4 = new Label("MaxApplicationAddress: -------------------------------------------- ") ; private Label l5 = new Label("ActiveProcessorMask : -------------------------------------------- ") ; private Label l6 = new Label("NumberOfProcessors: -------------------------------------------- ") ; private Label l7 = new Label("ProcessorType : -------------------------------------------- ") ; private Label l8 = new Label("ApplicationGranularity: -------------------------------------------- ") ; private Label l9 = new Label("ProcessorLevel: -------------------------------------------- ") ; private Label l10 = new Label("ProcessorRevision: -------------------------------------------- ") ; protected SYSTEM_INFO sysinfo; public void init() { Panel p1 = new Panel() ; p1.setLayout(new GridLayout(11,1)); p1.add(l0); p1.add(l1); p1.add(l2); p1.add(l3); p1.add(l4); p1.add(l5); p1.add(l6); p1.add(l7); p1.add(l8); p1.add(l9); p1.add(l10); add(p1) ; sysinfo = new SYSTEM_INFO() ; try { if (Class.forName("com.ms.security.PolicyEngine") != null) // get permissions PolicyEngine.assertPermission(PermissionID.SYSTEM); getSysInfo() ; } catch (Throwable cnfe) { } } private void getSysInfo() { GetSystemInfo(sysinfo) ; l1.setText("ProcessorArchitecture: " + sysinfo.wProcessorArchitecture) ; l2.setText("PageSize: " + sysinfo.dwPageSize) ; l3.setText("MinAppAddress: " + sysinfo.lpMinimumApplicationAddress) ; l4.setText("MaxAppAddress: " + sysinfo.lpMaximumApplicationAddress) ; l5.setText("ActiveProcessorMask: " + sysinfo.dwActiveProcessorMask) ; l6.setText("NumberOfProcessors: " + sysinfo.dwNumberOfProcessors) ; l7.setText("ProcessorType: " + sysinfo.dwProcessorType) ; l8.setText("AllocationGranularity: " + sysinfo.dwAllocationGranularity) ; l9.setText("ProcessorLevel: " + sysinfo.wProcessorLevel) ; l10.setText("ProcessorRevision: " + sysinfo.wProcessorRevision) ; repaint() ; } public void paint(Graphics g) { // black border around applet panel g.setColor(Color.black) ; g.drawRect(0,0,this.getSize().width-1, this.getSize().height-1) ; } /** @dll.import("KERNEL32") */ static native void GetSystemInfo(SYSTEM_INFO lpSystemInfo); } /** @dll.struct() */ class SYSTEM_INFO { public short wProcessorArchitecture; public short wReserved; public int dwPageSize; public int lpMinimumApplicationAddress; public int lpMaximumApplicationAddress; public int dwActiveProcessorMask; public int dwNumberOfProcessors; public int dwProcessorType; public int dwAllocationGranularity; public short wProcessorLevel; public short wProcessorRevision; }