================================================================
 WPS Photo Viewer + Baidu Netdisk "Smart Viewer/Player" Cleaner
================================================================

WHAT THIS REMOVES
-----------------
WPS Office and Baidu Netdisk silently install their own "photo viewer"
components and try to take over your image files. This tool removes them.

  1. Baidu Netdisk "Smart Image Viewer"   (module\ImageViewer)
  2. Baidu Netdisk "Smart Player"         (module\VastPlayer + player DLLs)
  3. WPS Office "WPS Photo Viewer"        (photolaunch.exe + WPS.PIC.* entries)

Typical savings: 300-500 MB on disk.


WHAT THIS DOES *NOT* TOUCH
--------------------------
  * WPS Office itself  (wps.exe / et.exe / wpp.exe keep working)
  * Baidu Netdisk itself (the main client keeps working)
  * Your documents, cloud files, settings
  * The built-in Windows Photos app
  * Your default image viewer setting (it is only restored if hijacked)


HOW TO USE
----------
EASIEST:  double-click the .cmd launcher in this folder
          (its filename is in Chinese: "yi jian qing chu WPS kan tu yu
          mou du kan tu.cmd" = "one-click cleanup")
          Click "Yes" on the UAC prompt when it appears.

ALTERNATIVE (no .cmd needed):  right-click
          Remove-WpsAndBaiduViewer.ps1
          and choose "Run with PowerShell".
          The script elevates itself.

IMPORTANT: keep BOTH files in the SAME folder. The .cmd calls the .ps1
           from its own directory.


SCAN FIRST (RECOMMENDED, CHANGES NOTHING)
-----------------------------------------
Open PowerShell and run:

  powershell -NoProfile -ExecutionPolicy Bypass -File "$env:USERPROFILE\Downloads\Remove-WpsAndBaiduViewer.ps1" -DryRun

It prints exactly what WOULD be deleted and touches nothing.
Adjust the path to wherever you saved the file.


OPTIONS
-------
  -DryRun              scan and report only; nothing is changed
  -Force               skip the confirmation prompt (unattended use)
  -DoNotTouchWpsFiles  clean WPS registry only, keep photolaunch.exe on disk
  -NoPlaceholder       do not plant a blocker file (see below)
  -KeepLog             keep the log file even when the run succeeds


EXIT CODES
----------
  0  success
  1  finished, but some operations failed
  2  elevation was denied or could not start
  3  you cancelled at the confirmation prompt


SAFETY NOTES
------------
* The script asks for confirmation before doing anything.
* It requires administrator rights, because WPS may be installed
  machine-wide and Prefetch is a system folder.
* It backs up nothing, but it only deletes files that belong to these
  specific bundled components - never config, user data or documents.
* Full transcript is written to %TEMP%\clean_viewers_<timestamp>.log
  (kept automatically when there are failures).
* It is safe to run repeatedly. Already-clean items report "not found".


WHAT IS THE PLACEHOLDER FILE?
-----------------------------
After deleting photolaunch.exe, the script creates a 0-byte READ-ONLY
file with the same name, in the same folder. Its purpose is to stop a
future WPS update from silently restoring the viewer.

If WPS ever complains or offers to "repair" itself, simply re-run with:

  -NoPlaceholder

which removes nothing extra and lets you use WPS normally again.


IF IT COMES BACK
----------------
Software updates can re-add these components. That is a vendor decision,
not something a script can permanently prevent. If they reappear:

  1. Run this tool again (it is safe and idempotent).
  2. Stop the updates at the source:
       WPS        : Settings -> Repair/Config tool -> Advanced
                    -> Update settings -> turn OFF auto update
       Baidu      : Settings -> General -> uncheck auto update


TROUBLESHOOTING
---------------
"Running scripts is disabled on this system"
    Use the .cmd launcher instead - it passes -ExecutionPolicy Bypass.

"Access is denied" / nothing gets deleted
    You declined the UAC prompt. Run again and click "Yes".
    Or right-click the .cmd and pick "Run as administrator".

Some files could not be deleted
    They are in use. Reboot and run the tool again - leftovers are kept
    in the log so you can see exactly which ones.

WPS asks to repair itself after running
    Re-run with -NoPlaceholder (see above).


TECHNICAL / VERIFICATION
------------------------
Both files are pure ASCII with no BOM, so they display correctly on any
Windows language setting. They work on Windows 10 and 11 with either
Windows PowerShell 5.1 or PowerShell 7+.

Verify the files have not been tampered with:

  Get-FileHash .\Remove-WpsAndBaiduViewer.ps1 -Algorithm SHA256

  Remove-WpsAndBaiduViewer.ps1
      SHA256 B92A775B02C02EA640BE7499FDD00477896C2C1589F1E596E0F6549E5BD053E8
  <the .cmd launcher>
      SHA256 C5ADA2C54D7BD2FC78947F5A7FD1183DC6BE08FDA56F5D2F23A6CCEA9BAA2DDE

Compare against the values published by whoever gave you these files.

The source is plain readable PowerShell - you can open it in Notepad or
any editor and review every registry key and path it touches before
running it. Nothing is downloaded and nothing is sent anywhere.

================================================================
