was ist an dem Code "verkehrt" ?
c:\ALASKA\WMI>xpp Win32_Directory.PRG
Xbase++ (R) Compiler 1.90.355 Apr 10 2009
Copyright (c) Alaska Software. All rights reserved.
File: Win32_Directory.PRG Line: 113
Win32_Directory.PRG(96:0): error XBT0251: Reserved keyword
1 error(s) found in file Win32_Directory.PRG!
Code: Alles auswählen
#include "common.ch"
#include "os.ch"
#define CRLF CHR(13)+CHR(10)
#PRAGMA LIBRARY("ASCOM10.LIB")
STATIC lVISTA := .F.
PROCEDURE Main(strComputer)
LOCAL objWMIService
LOCAL colItems
LOCAL cText
LOCAL cName
LOCAL bCollBlock
LOCAL i,iMax
LOCAL aitem := {}
LOCAL aProp := {;
"AccessMask",;
"Archive",;
"Caption",;
"Compressed",;
"CompressionMethod",;
"CreationClassName",;
"CreationDate",;
"CSCreationClassName",;
"CSName",;
"Description",;
"Drive",;
"EightDotThreeFileName",;
"Encrypted",;
"EncryptionMethod",;
"Extension",;
"FileName",;
"FileSize",;
"FileType",;
"FSCreationClassName",;
"FSName",;
"Hidden",;
"InstallDate",;
"InUseCount",;
"LastAccessed",;
"LastModified",;
"Name",;
"Path",;
"Readable",;
"Status",;
"System" }
DEFAULT strComputer TO "Localhost"
CLS
SET ALTER TO Win32_Directory.TXT
SET ALTER ON
IF "VISTA" $ OS(OS_PRODUCT) .OR.;
"WIN2003" $ OS(OS_PRODUCT) .OR.;
"WIN2008" $ OS(OS_PRODUCT)
lVISTA := .T.
ENDIF
IF lVISTA
objWMIService := CreateObject("WbemScripting.SWbemLocator" ):ConnectServer(strComputer,"Root\CIMv2")
ELSE
objWMIService := GetObject("WinMgmts:\\"+strComputer+"\Root\CIMv2")
ENDIF
colItems := objWMIService:ExecQuery("select * from Win32_Directory",,48)
bCollBlock := {|oService,n| AADD(aItem,{ n,;
oService:AccessMask,;
oService:Archive,;
oService:Caption,;
oService:Compressed,;
oService:CompressionMethod,;
oService:CreationClassName,;
oService:CreationDate,;
oService:CSCreationClassName,;
oService:CSName,;
oService:Description,;
oService:Drive,;
oService:EightDotThreeFileName,;
oService:Encrypted,;
oService:EncryptionMethod,;
oService:Extension,;
oService:FileName,;
oService:FileSize,;
oService:FileType,;
oService:FSCreationClassName,;
oService:FSName,;
oService:Hidden,;
oService:InstallDate,;
oService:InUseCount,;
oService:LastAccessed,;
oService:LastModified,;
oService:Name,;
oService:Path,;
oService:Readable,;
oService:Status,;
oService:System })}
ComEvalCollection(colItems, bCollBlock )
IF LEN(aItem) > 0
? iMax := LEN(aItem[1])
FOR i := 1 TO iMax-1
? SUBSTR(aProp[i]+SPACE(40),1,40)+":",aItem[1,i+1]
NEXT
ENDIF
SET ALTER OFF
SET ALTER TO
Runshell("Win32_Directory.TXT","Notepad.exe",.T.)
RETURN
hier die selbe Konstruktion, aber ohne "Reserved keyword" die zeigt das es nicht an dem
"Generator" liegt.
Code: Alles auswählen
#include "common.ch"
#include "os.ch"
#define CRLF CHR(13)+CHR(10)
#PRAGMA LIBRARY("ASCOM10.LIB")
STATIC lVISTA := .F.
PROCEDURE Main(strComputer)
LOCAL objWMIService
LOCAL colItems
LOCAL cText
LOCAL cName
LOCAL bCollBlock
LOCAL i,iMax
LOCAL aitem := {}
LOCAL aProp := {;
"BootDevice",;
"BuildNumber",;
"BuildType",;
"Caption",;
"CodeSet",;
"CountryCode",;
"CreationClassName",;
"CSCreationClassName",;
"CSDVersion",;
"CSName",;
"CurrentTimeZone",;
"DataExecutionPrevention_32BitApplications",;
"DataExecutionPrevention_Available",;
"DataExecutionPrevention_Drivers",;
"DataExecutionPrevention_SupportPolicy",;
"Debug",;
"Description",;
"Distributed",;
"EncryptionLevel",;
"ForegroundApplicationBoost",;
"FreePhysicalMemory",;
"FreeSpaceInPagingFiles",;
"FreeVirtualMemory",;
"InstallDate",;
"LargeSystemCache",;
"LastBootUpTime",;
"LocalDateTime",;
"Locale",;
"Manufacturer",;
"MaxNumberOfProcesses",;
"MaxProcessMemorySize",;
"Name",;
"NumberOfLicensedUsers",;
"NumberOfProcesses",;
"NumberOfUsers",;
"Organization",;
"OSLanguage",;
"OSProductSuite",;
"OSType",;
"OtherTypeDescription",;
"PlusProductID",;
"PlusVersionNumber",;
"Primary",;
"ProductType",;
"QuantumLength",;
"QuantumType",;
"RegisteredUser",;
"SerialNumber",;
"ServicePackMajorVersion",;
"ServicePackMinorVersion",;
"SizeStoredInPagingFiles",;
"Status",;
"SuiteMask",;
"SystemDevice",;
"SystemDirectory",;
"SystemDrive",;
"TotalSwapSpaceSize",;
"TotalVirtualMemorySize",;
"TotalVisibleMemorySize",;
"Version" }
DEFAULT strComputer TO "Localhost"
CLS
SET ALTER TO Win32_OperatingSystem.TXT
SET ALTER ON
IF "VISTA" $ OS(OS_PRODUCT) .OR.;
"WIN2003" $ OS(OS_PRODUCT) .OR.;
"WIN2008" $ OS(OS_PRODUCT)
lVISTA := .T.
ENDIF
IF lVISTA
objWMIService := CreateObject("WbemScripting.SWbemLocator"):ConnectServer(strComputer,"Root\CIMv2")
ELSE
objWMIService := GetObject("WinMgmts:\\"+strComputer+"\Root\CIMv2")
ENDIF
colItems := objWMIService:ExecQuery("select * from Win32_OperatingSystem",,48)
bCollBlock := {|oService,n| AADD(aItem,{ n,;
oService:BootDevice,;
oService:BuildNumber,;
oService:BuildType,;
oService:Caption,;
oService:CodeSet,;
oService:CountryCode,;
oService:CreationClassName,;
oService:CSCreationClassName,;
oService:CSDVersion,;
oService:CSName,;
oService:CurrentTimeZone,;
oService:DataExecutionPrevention_32BitApplications,;
oService:DataExecutionPrevention_Available,;
oService:DataExecutionPrevention_Drivers,;
oService:DataExecutionPrevention_SupportPolicy,;
oService:Debug,;
oService:Description,;
oService:Distributed,;
oService:EncryptionLevel,;
oService:ForegroundApplicationBoost,;
oService:FreePhysicalMemory,;
oService:FreeSpaceInPagingFiles,;
oService:FreeVirtualMemory,;
oService:InstallDate,;
oService:LargeSystemCache,;
oService:LastBootUpTime,;
oService:LocalDateTime,;
oService:Locale,;
oService:Manufacturer,;
oService:MaxNumberOfProcesses,;
oService:MaxProcessMemorySize,;
oService:Name,;
oService:NumberOfLicensedUsers,;
oService:NumberOfProcesses,;
oService:NumberOfUsers,;
oService:Organization,;
oService:OSLanguage,;
oService:OSProductSuite,;
oService:OSType,;
oService:OtherTypeDescription,;
oService:PlusProductID,;
oService:PlusVersionNumber,;
oService:Primary,;
oService:ProductType,;
oService:QuantumLength,;
oService:QuantumType,;
oService:RegisteredUser,;
oService:SerialNumber,;
oService:ServicePackMajorVersion,;
oService:ServicePackMinorVersion,;
oService:SizeStoredInPagingFiles,;
oService:Status,;
oService:SuiteMask,;
oService:SystemDevice,;
oService:SystemDirectory,;
oService:SystemDrive,;
oService:TotalSwapSpaceSize,;
oService:TotalVirtualMemorySize,;
oService:TotalVisibleMemorySize,;
oService:Version })}
ComEvalCollection(colItems, bCollBlock )
IF LEN(aItem) > 0
? iMax := LEN(aItem[1])
FOR i := 1 TO iMax-1
? SUBSTR(aProp[i]+SPACE(40),1,40)+":",aItem[1,i+1]
NEXT
ENDIF
SET ALTER OFF
SET ALTER TO
Runshell("Win32_OperatingSystem.TXT","Notepad.exe",.T.)
RETURN