Jump to content

RustDesk UDF


Go to solution Solved by BinaryBrother,

Recommended Posts

Posted

It needs to be slightly modified to use the MSI, instead of the EXE installer. The MSI handles firing up the service, instead of having to do it manually.

This UDF is close enough for you guys to modify and use. I won't be maintaining unless interest is expressed.

SIGNATURE_0X800007D NOT FOUND

Posted
1 hour ago, BinaryBrother said:

I won't be maintaining unless interest is expressed.

Global $g_RustDesk_CallForSupportStr = "Please call (XXX)-XXX-XXXX for support!"

Func _RustDesk_CallForSupportStr($sStr = Default)
    If $sStr <> Default Then $g_RustDesk_CallForSupportStr = $sStr
    Return $g_RustDesk_CallForSupportStr
EndFunc   ;==>_RustDesk_CallForSupportStr

That is a better idea. Maybe go the extra mile and add a function just for that.

Making a UDF is a pain. In my case because I can hear the complains in my head and change the UDF to appease those in my mind. Shut up already !, am typing ! 🤪
But those ideas don't come to mind beforehand. Only after some exposure is that they pop-up.

In either case, if you maintain it, you'll be a better coder. Even if no one uses it, so, thanks for sharing and do keep it up.    :gathering: 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted

Yeah, I thought it was a pretty good foundation. I made a quick sc.exe "Service Control" wrapper, but if you use the MSI you don't need it.

And yeah, I could definitely throw the repeated text into a variable.

SIGNATURE_0X800007D NOT FOUND

Posted (edited)

I'm taking your advice, and maintaining, but I don't have the time to de-customize every aspect.

Uploads on main post: Updated.

Removed in-post static code.

Edited by BinaryBrother

SIGNATURE_0X800007D NOT FOUND

Posted (edited)

I created the relay server myself and installed RustDesk using the auto install script via ps. It seems your UDF is not detecting it.

RD.png

Edited by Trong
https://vnc.my/WindowsAgentAIOInstall.ps1

Regards,
 

Posted

It's looking for a registry key to determine the local version, as per the PowerShell script provided, I used...

Global $g_RustDesk_RegPath = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\RustDesk"
Global $g_RustDesk_RegKey = "Version"

What value do you have at that location?

SIGNATURE_0X800007D NOT FOUND

  • Solution
Posted (edited)

I had a similar problem running the script under x86. Make sure you're running x64 through scite, or compile the scripts for x64 support.

I'm gonna update the UDF one more time, I have to remove all my personal info so it'll take me a second.

Edit: I shared my current working version in the first post. Just make sure you're running under an x64 atmosphere. You'll have to remove my personalizations, I don't have time right now but I still want to see you get this working.

To be clear, this is dirty. You'll have to do some housekeeping.

Also, you can try changing HKLM to HKLM64, if you're intent on running in an x86 environment.

And Kudos to you for accurately describing your issue with screenshots.

Final Edit: I did not account for using custom relays in this UDF. I only intended to Install/Update RustDesk and return the ID and Pass back to my server. And in my defense, the provided PowerShell script was horrid. Using sleeps to wait for services to start, etc. At least, my conversion actually checks for a running service, and attempts to start it if found or install it if it's missing. There's NO error checking in that PS script. Anywho... I've patched this together with a bottle of brandy and just got back from the ER over bronchitis. Ask me specifics and I'll try to detail things a bit better, but for now I'm just giving you what I have.

I cleaned it up and fixed the first post.

Edited by BinaryBrother
Warnings

SIGNATURE_0X800007D NOT FOUND

Posted (edited)

Alright, I decided to make a proper UDF.

Error handling is moved to user context or the main thread. Misc UDFs are now included within the primary RustDesk.au3 and x86 builds are now supported.

I will humbly accept advice, I know it needs some work. The Service Control portion is cringe.

Edited by BinaryBrother

SIGNATURE_0X800007D NOT FOUND

Posted (edited)

Re-wrote sections involving the Service Control. The service is critical, because RustDesk does not provide an interface for the --get-id and --set-password routines without it. Added Service Control Timeout params in some of the functions.

I tested the MSI on Windows 10 and Windows 11 through a virtual environment and found that in almost all instances, if the MSI is deployed, the service is immediately installed. If you install the EXE version, it doesn't init its-own service.

Anywho, I just completed a slight overhaul. The new src can be found on the first thread. It has been minimally tested. I've began adding support for those configuration hashes, but since I don't need that functionality progress will be slow.

Update: I keep saying I'm not gonna work on it much, but I can't help it. I added support for Config Hashes for configuring custom relays. Untested. Working!

Edited by BinaryBrother

SIGNATURE_0X800007D NOT FOUND

Posted (edited)

Rust Desk is killing me... Sometimes the MSI starts the service, but sometimes it doesn't. I can uninstall and reinstall several times in a row and the service will fail to start like 20% of the time. Then... Half the time STDOUT gets stuck in the primary thread (Returning Flutter info), when I try to use RustDesk's CLI for getting the ID, installing the service, or setting the password. I only switched to using the MSI, because it handles service creation and starting automatically. Installing the EXE has the same STDOUT sinkhole, but rarely handles the service bit.

RustDesk has bugs, when it comes to CLI, that I'm having to work-around with hacks (timeouts) or by not even getting the input and just firing the command. This UDF works, but I don't like those two bugs.

1.) RustDesk CLI likes to get stuck on the main thread with STDOUT when passing commands. (All I can do is timeout or avoid ShellExecuteWait, RunWait, and also avoid reading STDOUT.
2.) The Service has to be manually initiated half the time. (Which I've mostly fixed)

Wish somebody would give it a look and suggest some revision. Even if I use timeouts for reading the STDOUT, when the "sinkhole" happens, it doesn't return useful data.

I suppose with the service creations, I could go with the following logic.

If _RustDesk_isRunning() And Not _RustDesk_Service_isInstalled() Then manually use SC to install the service, rather than getting trapped in an STDOUT sinkhole using the RustDesk CLI. Okay, I can do that...

Then I'd just need to figure out why I'm getting stuck in STDOUT sinkholes for the other commands that require the use of the RustDesk CLI. Maybe RustDesk has to be running before using the CLI? I'll experiment more with checking if the process is running yet.

Edit: The "sinkholes" happen with CMD, "RustDesk.exe --install-service | more" too. There's no regular output, which is strange to me. More has to be used to capture the output. AutoIt can see the STDOUT stream, but CMD on Windows cannot, without piping the output to more.

Edited by BinaryBrother

SIGNATURE_0X800007D NOT FOUND

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...