• Welcome to Valhalla Legends Archive.
 

Updater

Started by Clan CDH, June 01, 2006, 11:26 PM

Previous topic - Next topic

Clan CDH

How would I make an updater for one of my programs that checks every time you startup the program for it to update if there is a new version available?  I really want it to be PHP based because I know how to read it and I know it's probably the simplest way to do it.  I'll be posting this questions in similar forums hoping to get an answer asap.

MyndFyre

One thing you should know is that your executables can't be overwritten while they're in memory.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

FrOzeN

On some webpage just have a file called "version.txt", then inside it just in plain text have the latest version, eg "1.2.0".

In your Visual Basic project, when it loads. You should call a function to access this webpage (probably easiest done with Inet, better to do with Winsock) and check to see if your .exe's version is the same as the one on the webpage. If it's not, tell the user that there program is out of date and provide them with a link to a new version, or setup your project to download the new version (which could be difficult).

Note that if you call Inet(), place the call in another function which has DoEvents above the call of Inet. This way your program doesn't freeze up while it checks the version.

You don't need php to do this.
~ FrOzeN

Spht

#3
There are several ways to do this.

If I recall correctly, Userloser's CheckVersion.bcp downloads a binary file on a web server that contains the latest build number, and compares that with the local copy and notifies the user of an update if it is different.

In WebBot, I utilize Botnet databases, and always keep an entry that is the current build information (this contains the build date, version info, and build number).  On each connect when the database is downloaded the user is notified and complete download instructions are presented if there is an update available.  Additionally, due to the nature of Botnet database updates, when a new version is published, all online Webbots are immediately notified of the update automatically.

Joe[x86]

If Inet1.OpenURL("http://some.web.server/path/sometextfile.txt") = App.Major & "." & App.Minor & "." & App.Revision Then
    ' Current
Else
    ' Upgrade
End If
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

Clan CDH

#5
some guy on the stealthbot forums told me to use msinet.ocx and it gives me an error, as for winsock, i really haven't learned it yet.  im trying a method that someone posted on another forum but this is by far the most helpful one that i've used so far.  thx and i could use some other input since i cant use the msinet.ocx

anyways i just tried this other method and it did not work, it was a post at vbcity made here and it did not work.  anyways i would try J's thing if the inet was working for me but i have to get a license thing and i'm using enterprise edition

FrostWraith

Quote from: Clan CDH on June 02, 2006, 11:40 AM
anyways i would try J's thing if the inet was working for me but i have to get a license thing and i'm using enterprise edition

Did you register it like FrOzeN explained?

Clan CDH

ya i did, do that if u saw my reply and i got it to work i needed the stupid vbclient to install the licenses for me so i just got that working

rabbit

As for winsock, which is by far the better method, use this: http://www.jmarshall.com/easy/http/
Specifically GET, as POST really is just not necessary at all for this sort of thing.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

Clan CDH

my pro friend says inet is way better but he cant help me right now cuz he's on vacation.

UserLoser

Quote from: MyndFyre[vL] on June 02, 2006, 01:38 AM
One thing you should know is that your executables can't be overwritten while they're in memory.

Not even with VirtualProtect, then dumping the memory block to a binary file?!

Hdx

Heres a bad way to do it.
But it works.
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
private patched as boolean

Private Sub Form_Terminate()
If patched Then x = Shell(App.Path & "\update.bat")
End Sub


Public Sub Update()
    If Inet.openURL("http://some.place.on.the.web/myProggie/currentver.txt") <> App.Major & "." & App.Minor & "." & App.Revision Then
        MsgBox "OMGEEZ J00S NOT UPDATED!!! UPDATORZING NOWZORZ LAWLEZ!!"
        Call URLDownloadToFile(0, "http://some.place.on.the.web/myProggie/Current.exe", App.Path & "\update.exe", 0, 0)
       
        Open App.Path & "\update.bat" For Output As #1
            Print #1, "ren " & App.EXEName & ".exe " & "OLD_VER-" & App.Major & "." & App.Minor & "." & App.Revision & ".exe"
            Print #1, "ren update.exe " & App.EXEName & ".exe"
            Print #1, "run " & App.EXEName & ".exe"
        Close #1
        patched = True
        For Each frm In Forms
            Unload frm
        Next frm
    Else
        MsgBox "OMG JOOS UPDATED!! 1337 YOEZ!!!"
    End If
End Sub

Note: I'm extreamly bored sitting in class so I wrote this in like 2 mins
~-~(HDX)~-~

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

Clan CDH

#12
Quote from: HdxBmx27 on June 05, 2006, 11:44 AM
Heres a bad way to do it.
But it works.
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
private patched as boolean

Private Sub Form_Terminate()
If patched Then x = Shell(App.Path & "\update.bat")
End Sub


Public Sub Update()
    If Inet.openURL("http://some.place.on.the.web/myProggie/currentver.txt") <> App.Major & "." & App.Minor & "." & App.Revision Then
        MsgBox "OMGEEZ J00S NOT UPDATED!!! UPDATORZING NOWZORZ LAWLEZ!!"
        Call URLDownloadToFile(0, "http://some.place.on.the.web/myProggie/Current.exe", App.Path & "\update.exe", 0, 0)
       
        Open App.Path & "\update.bat" For Output As #1
            Print #1, "ren " & App.EXEName & ".exe " & "OLD_VER-" & App.Major & "." & App.Minor & "." & App.Revision & ".exe"
            Print #1, "ren update.exe " & App.EXEName & ".exe"
            Print #1, "run " & App.EXEName & ".exe"
        Close #1
        patched = True
        For Each frm In Forms
            Unload frm
        Next frm
    Else
        MsgBox "OMG JOOS UPDATED!! 1337 YOEZ!!!"
    End If
End Sub

Note: I'm extreamly bored sitting in class so I wrote this in like 2 mins
~-~(HDX)~-~

thx im tryin this out now

edit:  i keep getting an error on this line(its the object required error)
Quote
    If Inet.OpenURL("http://mehateeggz.googlepages.com/CurrentVer.txt") <> App.Major & "." & App.Minor & "." & App.Revision Then

l2k-Shadow

You need to load inet into your app, (internet file transfer protocol) or something like that it should be called in your components (CTRL+T) directory.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

Clan CDH

Quote from: l2k-Shadow on June 05, 2006, 02:25 PM
You need to load inet into your app, (internet file transfer protocol) or something like that it should be called in your components (CTRL+T) directory.

i know, i m not that newbish, i think it might be a problem with my text file?
http://mehateeggz.googlepages.com/CurrentVer.txt