bmrf / tron

Tron

Home Page:https://old.reddit.com/r/TronScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

32bit detection error

borekon opened this issue · comments

I wrote a post 3 years ago with this bug, but still was not resolved.
I'm using a 64 bit Windows 10, but the script detects it as 32 bit system (it happens from v11.1 to 12.0.4):
imagen
Because this error, the USB DriveCleanUp is not working:
imagen

Can you please post the results of running: "tron.bat -c"

There you go:

 
  Loading...

   Updating SMART drive database, please wait...

   Done.

   Detecting disks...

   Done.

   Checking repo for updated Tron version...

   Done.


 Tron v12.0.4 (2022-10-23) config dump

 Command-line switches:
  -c

 User-set variables:
   AUTORUN:                no
   AUTORUN_IN_SAFE_MODE:   no
   AUTO_REBOOT_DELAY:      0
   AUTO_SHUTDOWN:          no
   CONFIG_DUMP:            yes
   DEV_MODE:               no
   DRY_RUN:                no
   EMAIL_REPORT:           no
   EULA_ACCEPTED:          no
   LOGFILE:                tron.log
   LOGPATH:                C:\logs\tron
   NO_PAUSE:               no
   PRESERVE_METRO_APPS:    no
   PRESERVE_POWER_SCHEME:  no
   PRESERVE_MALWAREBYTES:  no
   QUARANTINE_PATH:        C:\logs\tron\quarantine
   SELF_DESTRUCT:          no
   SKIP_ANTIVIRUS_SCANS:   no
   SKIP_APP_PATCHES:       no
   SKIP_CUSTOM_SCRIPTS:    no
   SKIP_DEBLOAT:           no
   SKIP_DEBLOAT_UPDATE:    no
   SKIP_DEFRAG:            no
   SKIP_DISM_CLEANUP:      no
   SKIP_EVENT_LOG_CLEAR:   no
   SKIP_KASPERSKY_SCAN:    no
   SKIP_MBAM_INSTALL:      no
   SKIP_ONEDRIVE_REMOVAL:  no
   SKIP_PAGEFILE_RESET:    no
   SKIP_SOPHOS_SCAN:       no
   SKIP_TELEMETRY_REMOVAL: no
   SKIP_WINDOWS_UPDATES:   no
   SKIP_WSUS_OFFLINE:      no
   UNICORN_POWER_MODE:     off
   UPLOAD_DEBUG_LOGS:      no
   VERBOSE:                no

 Script-internal variables:
   BAD_RUNPATH:            no
   CUR_DATE:               2023-02-13
   DTS:                    20230213100251.853000+060
   FIND:                   C:\WINDOWS\System32\find.exe
   FINDSTR:                C:\WINDOWS\System32\findstr.exe
   FREE_SPACE_AFTER:       0
   FREE_SPACE_BEFORE:      0
   FREE_SPACE_SAVED:       0
   HELP:                   no
   NETWORK_AVAILABLE:      yes
   REG:                    C:\WINDOWS\System32\reg.exe
   SAFE_MODE:              no
   SAFEBOOT_OPTION:        
   SMART_PROBLEM_CODE:     undetected
   SYSTEM_LANGUAGE:        es
   TEMP:                   C:\Users\isabe\AppData\Local\Temp
   TARGET_METRO:           no
   TIME:                   10:02:55,44
   TIME_ZONE_NAME:         Romance Standard Time  

   TRON_DATE:              2022-10-23
   TRON_VERSION:           12.0.4
   PROCESSOR_ARCHITECTURE: AMD64
   REPO_TRON_DATE:         2023-02-02
   REPO_TRON_VERSION:      12.0.5
   RESUME_DETECTED:        no
   RESUME_SWITCHES:        0
   RESUME_STAGE:           0
   WIN_VER:                Windows 10 Home
   WIN_VER_NUM:            6.3
   WMIC:                   C:\WINDOWS\System32\wbem\wmic.exe

By the way, it's windows 11

PROCESSOR_ARCHITECTURE: AMD64

It successfully and correctly detected you are running AMD64

Can you send me the full log set for the run and I'll dig into this for you?

I verified the code executing is correct

@echo off
echo %PROCESSOR_ARCHITECTURE%
if /i '%PROCESSOR_ARCHITECTURE%'=='AMD64' (
echo "AMD64"
) else (
echo "X86"
)
pause

returns

AMD64
"AMD64"
Press any key to continue . . .

The only way you could be seeing what you are seeing, is that if the exe files are swapped or misnamed.

And I cannot recreate that either, I received different files and ran the 64 bit one directly via cli and it performed the action as expected.

64Bit Hash
DFD1F048CF9EEFE96A1266139D3683DE86ED25346300A0392EB5B2C10F4C78D1

32Bit Hash
C16B5CB963FFF0FC74CE725B14E2833FF00EB069B6E42C50B0C0FF6E4E36BD4C

PROCESSOR_ARCHITECTURE: AMD64

It successfully and correctly detected you are running AMD64

Can you send me the full log set for the run and I'll dig into this for you?

There you go:
https://nextcloud.tel/s/NKFM82Wz54CR5Cn

I know you mentioned that you are running a 64 bit version of windows, but please run this and paste the output. It needs to be ran in powershell with admin rights

`
$computer = Get-WmiObject -Class Win32_ComputerSystem
$processor = Get-WmiObject -Class Win32_Processor
$os = Get-WmiObject -Class Win32_OperatingSystem

$registry = [Microsoft.Win32.RegistryKey]::OpenBaseKey("LocalMachine", "CurrentUser")
$regKey1 = $registry.OpenSubKey("System\CurrentControlSet\Control\Session Manager\Environment")
$regKey2 = $registry.OpenSubKey("System\CurrentControlSet\Control\Session Manager\Environment")

$CPUArchitecture = $processor.AddressWidth
$OSArchitecture = $os.OSArchitecture
$RegistryValue1 = $regKey1.GetValue("PROCESSOR_ARCHITECTURE")
$RegistryValue2 = $regKey2.GetValue("PROCESSOR_ARCHITEW6432")
$EnvVariable1 = [Environment]::GetEnvironmentVariable("PROCESSOR_ARCHITECTURE")
$EnvVariable2 = [Environment]::GetEnvironmentVariable("PROCESSOR_ARCHITEW6432")

$results = @{
"CPU Architecture (x86 or x64)" = $CPUArchitecture
"OS Architecture (x86 or x64)" = $OSArchitecture
"Registry key value for CPU architecture" = $RegistryValue1
"Registry key value for OS architecture" = $RegistryValue2
"System Environment Variable for CPU architecture" = $EnvVariable1
"System Environment Variable for OS architecture" = $EnvVariable2
}

$results | Format-Table
`

PS C:\WINDOWS\system32> $computer = Get-WmiObject -Class Win32_ComputerSystem
PS C:\WINDOWS\system32> $processor = Get-WmiObject -Class Win32_Processor
PS C:\WINDOWS\system32> $os = Get-WmiObject -Class Win32_OperatingSystem
PS C:\WINDOWS\system32> $registry = [Microsoft.Win32.RegistryKey]::OpenBaseKey("LocalMachine", "CurrentUser")
No se puede convertir el argumento "view", con el valor: "CurrentUser", para
"OpenBaseKey", al tipo "Microsoft.Win32.RegistryView": "No se puede convertir
el valor "CurrentUser" al tipo "Microsoft.Win32.RegistryView". Error: "No se
puede hacer coincidir el nombre de identificador CurrentUser con un nombre de
enumerador válido. Especifique uno de los siguientes nombres de enumerador e
inténtelo de nuevo:
Default, Registry64, Registry32""
En línea: 1 Carácter: 1
+ $registry = [Microsoft.Win32.RegistryKey]::OpenBaseKey("LocalMachine" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

PS C:\WINDOWS\system32> $regKey1 = $registry.OpenSubKey("System\CurrentControlSet\Control\Session Manager\Environment")
No se puede llamar a un método en una expresión con valor NULL.
En línea: 1 Carácter: 1
+ $regKey1 = $registry.OpenSubKey("System\CurrentControlSet\Control\Ses ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

PS C:\WINDOWS\system32> $regKey2 = $registry.OpenSubKey("System\CurrentControlSet\Control\Session Manager\Environment")
No se puede llamar a un método en una expresión con valor NULL.
En línea: 1 Carácter: 1
+ $regKey2 = $registry.OpenSubKey("System\CurrentControlSet\Control\Ses ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

PS C:\WINDOWS\system32> $CPUArchitecture = $processor.AddressWidth
PS C:\WINDOWS\system32> $OSArchitecture = $os.OSArchitecture
PS C:\WINDOWS\system32> $RegistryValue1 = $regKey1.GetValue("PROCESSOR_ARCHITECTURE")
No se puede llamar a un método en una expresión con valor NULL.
En línea: 1 Carácter: 1
+ $RegistryValue1 = $regKey1.GetValue("PROCESSOR_ARCHITECTURE")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

PS C:\WINDOWS\system32> $RegistryValue2 = $regKey2.GetValue("PROCESSOR_ARCHITEW6432")
No se puede llamar a un método en una expresión con valor NULL.
En línea: 1 Carácter: 1
+ $RegistryValue2 = $regKey2.GetValue("PROCESSOR_ARCHITEW6432")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

PS C:\WINDOWS\system32> $EnvVariable1 = [Environment]::GetEnvironmentVariable("PROCESSOR_ARCHITECTURE")
PS C:\WINDOWS\system32> $EnvVariable2 = [Environment]::GetEnvironmentVariable("PROCESSOR_ARCHITEW6432")
PS C:\WINDOWS\system32> $results = @{
>> "CPU Architecture (x86 or x64)" = $CPUArchitecture
>> "OS Architecture (x86 or x64)" = $OSArchitecture
>> "Registry key value for CPU architecture" = $RegistryValue1
>> "Registry key value for OS architecture" = $RegistryValue2
>> "System Environment Variable for CPU architecture" = $EnvVariable1
>> "System Environment Variable for OS architecture" = $EnvVariable2
>> }
PS C:\WINDOWS\system32> $results | Format-Table

Name                           Value
----                           -----
Registry key value for CPU ...
System Environment Variable... AMD64
System Environment Variable...
Registry key value for OS a...
OS Architecture (x86 or x64)   64 bits
CPU Architecture (x86 or x64)  64

I'm unable to reproduce on my machine (win10 22h2) or VMs (win7 through 2019). Are you still experiencing this?

Yes; actually last week happened again (on Windows 11):
**2023-06-21 14:19:58,78** Launch job 'USB Device Cleanup'... DriveCleanup V1.6.3 (Win32) Uninstalls non present USB hubs, USB storage devices, Disks, CDROMs, Floppies, storage volumes and WPD devices and deletes their registry items Freeware by Uwe Sieber - www.uwe-sieber.de Error: The Win32 release of DriveCleanup does not work on x64 Windows -> abort
By the way, languaje code is es_ES. IDK if it helps

What is the output of this command if you run it in a command-prompt? (NOT PowerShell)

echo %processor_architecture%

What is the output of this command if you run it in a command-prompt? (NOT PowerShell)

echo %processor_architecture%
imagen

commented

@borekon
If you feel comfortable in editing a file. We might be able to fix this issue for you. I know vocatus & TylersComputersKC will probably state this edit doesn't make any sense or difference in the code, but read what borekon wrote "... By the way, languaje code is es_ES. IDK if it helps"

The command prompt (cmd.exe) interpreter is written, tested, and updated in English (en_US). I am suspecting that the Spanish (es_ES) culture code is interpreting the code of '%variable%'=='something' literally. Tronscript uses this code style many times, but this is the ONLY time it is used as the primary decision.

Now back to what file and code needs to be changed. The file "tron\resources\stage_1_tempclean\stage_1_tempclean.bat" needs to have (line 202 in the current code)
if /i '%PROCESSOR_ARCHITECTURE%'=='AMD64'
changed to read
if /i %PROCESSOR_ARCHITECTURE%==AMD64
You will be removing the single quotes or comillas simples from the line.

This is only a TEST to see if the command prompt interpreter on your (es_ES) system is reading the code literally.
The result of this TEST will determine the course of action needed for the code of the stage_1_tempclean.bat file.

@borekon If you feel comfortable in editing a file. We might be able to fix this issue for you. I know vocatus & TylersComputersKC will probably state this edit doesn't make any sense or difference in the code, but read what borekon wrote "... By the way, languaje code is es_ES. IDK if it helps"

The command prompt (cmd.exe) interpreter is written, tested, and updated in English (en_US). I am suspecting that the Spanish (es_ES) culture code is interpreting the code of '%variable%'=='something' literally. Tronscript uses this code style many times, but this is the ONLY time it is used as the primary decision.

Now back to what file and code needs to be changed. The file "tron\resources\stage_1_tempclean\stage_1_tempclean.bat" needs to have (line 202 in the current code) if /i '%PROCESSOR_ARCHITECTURE%'=='AMD64' changed to read if /i %PROCESSOR_ARCHITECTURE%==AMD64 You will be removing the single quotes or comillas simples from the line.

This is only a TEST to see if the command prompt interpreter on your (es_ES) system is reading the code literally. The result of this TEST will determine the course of action needed for the code of the stage_1_tempclean.bat file.

Hi @RedBaron2 ,

Writting both in cmd (just testing) appears to work:
image

I'll modify that file and test in a VBOX machine.
Thanks for your time :)

Hi @RedBaron2 and @borekon , did removing the single quotes change the outcome? I've been following this thread and would like to get a fix in before the next version goes out if possible.

Hi @RedBaron2 and @borekon , did removing the single quotes change the outcome? I've been following this thread and would like to get a fix in before the next version goes out if possible.

It seems to be working now:
image

Taking a look in the file that i've been modified, i saw that the singles quotes are not present, for example, when calling CCleaner:
image

commented

@vocatus
I suggest for the next release taking out the single quotes in this section of code.
@borekon
Your discovery of the missing quotes is what made me suggest the edit. I'm glad it is working now.

@RedBaron2 removed the single quotes from the section that calls the USB cleanup

@borekon Updated file is going out with new release today. Thanks for reporting!