86 privateIn:Win32OperatingSystem |
86 privateIn:Win32OperatingSystem |
87 ! |
87 ! |
88 |
88 |
89 Object subclass:#PerformanceData |
89 Object subclass:#PerformanceData |
90 instanceVariableNames:'objectArray perfTime perfFreq perfTime100nSec' |
90 instanceVariableNames:'objectArray perfTime perfFreq perfTime100nSec' |
91 classVariableNames:'PerformanceText CounterIndexTextDictionary |
91 classVariableNames:'CounterIndexTextDictionary HelpIndexTextDictionary |
92 HelpIndexTextDictionary' |
92 PerformanceText' |
93 poolDictionaries:'' |
93 poolDictionaries:'' |
94 privateIn:Win32OperatingSystem |
94 privateIn:Win32OperatingSystem |
95 ! |
95 ! |
96 |
96 |
97 Object subclass:#Abstract |
97 Object subclass:#Abstract |
6351 | rslt | |
6351 | rslt | |
6352 |
6352 |
6353 %{ /* STACK: 8000*/ |
6353 %{ /* STACK: 8000*/ |
6354 char buffer[MAXPATHLEN+1]; |
6354 char buffer[MAXPATHLEN+1]; |
6355 |
6355 |
6356 int __rslt; |
6356 int __rslt = 0; |
6357 #if 1 // only change to 0 if all systems/compiles support GetSystemWow64DirectoryW |
6357 #if defined(__BORLANDC__) // only change to 0 if all systems/compiles support GetSystemWow64DirectoryW |
6358 // starting with Windows 8, this: |
6358 // starting with Windows XP, this: |
6359 // GetSystemWow64DirectoryW(&fileTime); |
6359 // GetSystemWow64DirectoryW(&fileTime); |
6360 // can be called directly. |
6360 // can be called directly. |
6361 { |
6361 { |
6362 typedef unsigned int (WINAPI *P_GetSystemWow64DirectoryW)(LPTSTR, unsigned int); |
6362 typedef unsigned int (WINAPI *P_GetSystemWow64DirectoryW)(LPTSTR, unsigned int); |
6363 static P_GetSystemWow64DirectoryW pGetSystemWow64DirectoryW = NULL; |
6363 static P_GetSystemWow64DirectoryW pGetSystemWow64DirectoryW = NULL; |
6364 static int didCheck = 0; |
6364 static int didCheck = 0; |
6365 |
6365 |
6366 if (pGetSystemWow64DirectoryW == NULL) { |
6366 if (pGetSystemWow64DirectoryW == NULL) { |
6367 if (!didCheck) { |
6367 if (!didCheck) { |
6368 pGetSystemWow64DirectoryW = |
6368 pGetSystemWow64DirectoryW = |
6369 (P_GetSystemWow64DirectoryW) |
6369 (P_GetSystemWow64DirectoryW) |
6370 GetProcAddress ( GetModuleHandle ("kernel32.dll"), |
6370 GetProcAddress ( GetModuleHandle ("kernel32.dll"), |
6371 "GetSystemWow64DirectoryW"); |
6371 "GetSystemWow64DirectoryW"); |
6372 |
6372 |
6373 didCheck = 1; |
6373 didCheck = 1; |
6374 } |
6374 } |
6375 } |
6375 } |
6376 |
6376 |
6377 if (pGetSystemWow64DirectoryW != NULL) { |
6377 if (pGetSystemWow64DirectoryW != NULL) { |
6378 __rslt = nil; |
6378 __rslt = (*pGetSystemWow64DirectoryW)(buffer, MAXPATHLEN); |
6379 } else { |
6379 } |
6380 __rslt = (*pGetSystemWow64DirectoryW)(buffer, MAXPATHLEN); |
|
6381 } |
|
6382 } |
6380 } |
6383 #else |
6381 #else |
6384 __rslt = GetSystemWow64DirectoryW(buffer, MAXPATHLEN); |
6382 __rslt = GetSystemWow64DirectoryW(buffer, MAXPATHLEN); |
6385 #endif |
6383 #endif |
6386 if (__rslt != nil) { |
6384 if (__rslt != 0) { |
6387 rslt = __mkStringOrU16String_maxlen(buffer, MAXPATHLEN); |
6385 rslt = __mkStringOrU16String_maxlen(buffer, MAXPATHLEN); |
6388 } |
6386 } |
6389 %}. |
6387 %}. |
6390 ^ rslt |
6388 ^ rslt |
6391 |
6389 |
6392 "Modified: / 11-02-2014 / 21:18:20 / cg" |
6390 "Modified: / 11-02-2014 / 21:18:20 / cg" |
|
6391 "Modified: / 07-03-2019 / 15:47:39 / Stefan Vogel" |
6393 ! |
6392 ! |
6394 |
6393 |
6395 getVolumeInformation: rootPath |
6394 getVolumeInformation: rootPath |
6396 name: volumeNameBuffer |
6395 name: volumeNameBuffer |
6397 nameSize: volumeNameSize |
6396 nameSize: volumeNameSize |
10480 |
10479 |
10481 "Created: / 27-07-2006 / 16:22:34 / fm" |
10480 "Created: / 27-07-2006 / 16:22:34 / fm" |
10482 ! |
10481 ! |
10483 |
10482 |
10484 documentPropertiesDialogFor:hwndOrNil hPrinter:hPrinter pDeviceName:deviceName devModeInput:pDevModeInputOrNil |
10483 documentPropertiesDialogFor:hwndOrNil hPrinter:hPrinter pDeviceName:deviceName devModeInput:pDevModeInputOrNil |
10485 |nBytesNeeded hPrinter rslt devModeOutput| |
10484 |nBytesNeeded rslt devModeOutput| |
10486 |
10485 |
10487 " |
10486 " |
10488 #define DM_UPDATE 1 |
10487 #define DM_UPDATE 1 |
10489 #define DM_COPY 2 |
10488 #define DM_COPY 2 |
10490 #define DM_PROMPT 4 |
10489 #define DM_PROMPT 4 |
10494 #define DM_IN_PROMPT DM_PROMPT |
10493 #define DM_IN_PROMPT DM_PROMPT |
10495 #define DM_OUT_BUFFER DM_COPY |
10494 #define DM_OUT_BUFFER DM_COPY |
10496 #define DM_OUT_DEFAULT DM_UPDATE |
10495 #define DM_OUT_DEFAULT DM_UPDATE |
10497 " |
10496 " |
10498 nBytesNeeded := self |
10497 nBytesNeeded := self |
10499 primDocumentProperties:nil |
10498 primDocumentProperties:nil |
10500 hPrinter:hPrinter |
10499 hPrinter:hPrinter |
10501 pDeviceName: deviceName |
10500 pDeviceName: deviceName |
10502 pDevModeOutput:nil |
10501 pDevModeOutput:nil |
10503 pDevModeInput:nil |
10502 pDevModeInput:nil |
10504 fMode:0. |
10503 fMode:0. |
10505 |
10504 |
10506 devModeOutput := DevModeStructure new:(nBytesNeeded * 2 "never trust MS !!"). |
10505 devModeOutput := DevModeStructure new:(nBytesNeeded * 2 "never trust MS !!"). |
10507 |
10506 |
10508 rslt := self |
10507 rslt := self |
10509 primDocumentProperties:nil |
10508 primDocumentProperties:nil |
10510 hPrinter:hPrinter |
10509 hPrinter:hPrinter |
10511 pDeviceName: deviceName |
10510 pDeviceName: deviceName |
10512 pDevModeOutput:devModeOutput |
10511 pDevModeOutput:devModeOutput |
10513 pDevModeInput:pDevModeInputOrNil |
10512 pDevModeInput:pDevModeInputOrNil |
10514 fMode:4+2. |
10513 fMode:4+2. |
10515 |
10514 |
10516 ^ devModeOutput |
10515 ^ devModeOutput |
10517 |
10516 |
10518 " |
10517 " |
10519 |h| |
10518 |h| |
10521 h := self openPrinter:'\\http://exept.exept.de:631\lj4'. |
10520 h := self openPrinter:'\\http://exept.exept.de:631\lj4'. |
10522 self documentPropertiesDialogFor:nil hPrinter:h pDeviceName:'\\http://exept.exept.de:631\lj4' devModeInput:nil |
10521 self documentPropertiesDialogFor:nil hPrinter:h pDeviceName:'\\http://exept.exept.de:631\lj4' devModeInput:nil |
10523 " |
10522 " |
10524 |
10523 |
10525 "Created: / 27-07-2006 / 15:39:21 / fm" |
10524 "Created: / 27-07-2006 / 15:39:21 / fm" |
|
10525 "Modified: / 07-03-2019 / 15:52:16 / Stefan Vogel" |
10526 ! |
10526 ! |
10527 |
10527 |
10528 endDoc: deviceContext |
10528 endDoc: deviceContext |
10529 ^ self primEndDoc:deviceContext |
10529 ^ self primEndDoc:deviceContext |
10530 |
10530 |
12274 |
12274 |
12275 "return a string with the users login name (thats yours)" |
12275 "return a string with the users login name (thats yours)" |
12276 |
12276 |
12277 %{ /* NOCONTEXT */ |
12277 %{ /* NOCONTEXT */ |
12278 static char cachedName[64]; |
12278 static char cachedName[64]; |
12279 static firstCall = 1; |
12279 static int firstCall = 1; |
12280 #ifndef __BORLANDC__ |
12280 #ifndef __BORLANDC__ |
12281 extern char *getenv(); |
12281 extern char *getenv(); |
12282 #endif |
12282 #endif |
12283 char *name = (char *)0; |
12283 char *name = (char *)0; |
12284 |
12284 |
12285 if (firstCall) { |
12285 if (firstCall) { |
12286 DWORD nameSize = sizeof(cachedName); |
12286 DWORD nameSize = sizeof(cachedName); |
12287 |
12287 |
12288 if (GetUserName(cachedName, &nameSize) == TRUE) { |
12288 if (GetUserName(cachedName, &nameSize) == TRUE) { |
12289 name = cachedName; |
12289 name = cachedName; |
12290 firstCall = 0; |
12290 firstCall = 0; |
12291 } |
12291 } |
12292 } else { |
12292 } else { |
12293 name = cachedName; |
12293 name = cachedName; |
12294 } |
12294 } |
12295 |
12295 |
12296 /* |
12296 /* |
12297 * try a few common environment variables ... |
12297 * try a few common environment variables ... |
12298 */ |
12298 */ |
12299 if (! name || (name[0] == 0) ) { |
12299 if (! name || (name[0] == 0) ) { |
12300 name = getenv("LOGIN"); |
12300 name = getenv("LOGIN"); |
12301 if (! name || (name[0] == 0) ) { |
12301 if (! name || (name[0] == 0) ) { |
12302 name = getenv("LOGNAME"); |
12302 name = getenv("LOGNAME"); |
12303 if (! name || (name[0] == 0) ) { |
12303 if (! name || (name[0] == 0) ) { |
12304 name = getenv("USER"); |
12304 name = getenv("USER"); |
12305 } |
12305 } |
12306 } |
12306 } |
12307 } |
12307 } |
12308 /* |
12308 /* |
12309 * nope - I really font know who you are. |
12309 * nope - I really font know who you are. |
12310 */ |
12310 */ |
12311 if (! name || (name[0] == 0) ) { |
12311 if (! name || (name[0] == 0) ) { |
12312 name = "you"; |
12312 name = "you"; |
12313 } |
12313 } |
12314 |
12314 |
12315 RETURN ( __MKSTRING(name) ); |
12315 RETURN ( __MKSTRING(name) ); |
12316 %}. |
12316 %}. |
12317 " |
12317 " |
12318 OperatingSystem getLoginName |
12318 OperatingSystem getLoginName |
12319 " |
12319 " |
|
12320 |
|
12321 "Modified: / 07-03-2019 / 16:00:27 / Stefan Vogel" |
12320 ! |
12322 ! |
12321 |
12323 |
12322 getUserID |
12324 getUserID |
12323 "{ Pragma: +optSpace }" |
12325 "{ Pragma: +optSpace }" |
12324 |
12326 |
14739 ! ! |
14741 ! ! |
14740 |
14742 |
14741 !Win32OperatingSystem::PerformanceData::Abstract methodsFor:'queries'! |
14743 !Win32OperatingSystem::PerformanceData::Abstract methodsFor:'queries'! |
14742 |
14744 |
14743 getCounterNameIndexArray |
14745 getCounterNameIndexArray |
14744 |data object debugBlock| |
14746 |index objectArray object debugBlock| |
14745 |
14747 |
14746 data := self data. |
14748 debugBlock := [:obj| |
14747 |
14749 ^ 'obj:', obj , ' this:', self printString , ' idx:', self indexedName |
14748 self indexedNameNumbered == 0 ifTrue:[ |
14750 ]. |
14749 object := data objectArray at:1 ifAbsent:[debugBlock value:(object at:#ObjectNameTitle)]. |
14751 |
|
14752 objectArray := self data objectArray. |
|
14753 index := self indexedNameNumbered. |
|
14754 |
|
14755 index == 0 ifTrue:[ |
|
14756 object := objectArray at:1 ifAbsent:[debugBlock value:(object at:#ObjectNameTitle)]. |
14750 ] ifFalse:[ |
14757 ] ifFalse:[ |
14751 object := data objectArray detect:[:el|(el at:#ObjectNameTitleIndex) == self indexedNameNumbered] ifNone:[self error:'counter not found']. |
14758 object := objectArray detect:[:el| (el at:#ObjectNameTitleIndex) == index] |
14752 ]. |
14759 ifNone:[self error:'counter not found']. |
14753 |
14760 ]. |
14754 ^ (object at:#Counters) collect:[:el|Array with:(el at:#CounterNameTitle) with:(el at:#CounterNameTitleIndex)]. |
14761 |
|
14762 ^ (object at:#Counters) |
|
14763 collect:[:el| {el at:#CounterNameTitle. el at:#CounterNameTitleIndex}]. |
|
14764 |
|
14765 "Modified: / 07-03-2019 / 16:29:51 / Stefan Vogel" |
14755 ! ! |
14766 ! ! |
14756 |
14767 |
14757 !Win32OperatingSystem::PerformanceData::Abstract methodsFor:'queries - timed'! |
14768 !Win32OperatingSystem::PerformanceData::Abstract methodsFor:'queries - timed'! |
14758 |
14769 |
14759 getPerSecondFromLast:aSelector |
14770 getPerSecondFromLast:aSelector |