PDA

View Full Version : Rpoblems with wininet.dll


Andreas
10-27-2008, 06:35 AM
Hi,

I have som problems with Trueupdate 3.0.1.0. When I use the http callbackfunction the update.exe crashes. If I remark those lines the application works perfectly. I tested my application in Dependency walker and found out that it is Wininet.dll that causes the application to fail. Is there a update that corrects this error?

jassing
10-27-2008, 09:19 AM
Hi,

I have som problems with Trueupdate 3.0.1.0. When I use the http callbackfunction the update.exe crashes. If I remark those lines the application works perfectly. I tested my application in Dependency walker and found out that it is Wininet.dll that causes the application to fail. Is there a update that corrects this error?

You should post the code that causes it to crash.

Andreas
10-28-2008, 05:15 AM
You should post the code that causes it to crash.

If i use Visual Studio to debug I get the following error codes:

Unhandled exception at 0x00481328 in Update.exe: 0xC0000005: Access violation reading location 0x00000040

/Andreas

jassing
10-28-2008, 09:33 AM
[QUOTE=Andreas;129864When I use the http callbackfunction the update.exe crashes. If I remark those lines the application works perfectly. [/QUOTE]

Why don't you post the http line and the callback function.

Andreas
10-29-2008, 08:08 AM
Why don't you post the http line and the callback function.

Hi.
The problem seams to occure on computers running IE6 and not IE7.

This is my HTTP download screen:



-- These actions are performed when the screen is shown.

-- Whether the Cancel button has been clicked.
-- We'll set this to true if the user clicks the Cancel button
-- to tell the HTTPDownloadCallback function to stop the download
screen_globals.Cancelled = false;

-- Initialize the progress bar
DlgProgressBar.SetRange(CTRL_PROGRESS_BAR_01, 0, 100);
DlgProgressBar.SetPos(CTRL_PROGRESS_BAR_01, 0);

-- Split the filename out from the full path for display purposes
local tableFileParts = String.SplitPath(screen_globals.DestinationPath);
local DestFilename = "";
if(tableFileParts) then
DestFilename = tableFileParts.Filename..tableFileParts.Extension;
end

-- from _TU20_Global_Functions.lua:
-- Get the website name (e.g. "www.yoursite.com") from the full URL
local WebSiteName = g_GetSiteNameFromURL(screen_globals.SourceURL);


-- Function: HTTPDownloadCallback
-- Purpose: A callback function used with the HTTP.Download
-- or HTTP.DownloadSecure action to report progress
-- to the user
-- Returns: true - if the update should continue
-- false - if the update should be aborted
function HTTPDownloadCallback(BytesDownloaded, FileSize, TransferRate, SecondsLeft, EstimatedTimeRemaining, ServerStatusMessage)

-- Did the user click Cancel?
if(screen_globals.Cancelled) then
-- Abort the download
return false;
end

-- Set the text to be displayed on the screen
--DlgStaticText.SetProperties(CTRL_STATICTEXT_LABEL_ 01, {Text=TrueUpdate.GetLocalizedString("MSG_DOWNLOADING")..": "..DestFilename.." "..TrueUpdate.GetLocalizedString("MSG_FROM").." "..WebSiteName});

-- Calculate the percentage that has been downloaded so far
local PercentComplete = 0;
if(FileSize > 0) then
PercentComplete = (BytesDownloaded / FileSize) * 100;
end

-- Update the progress bar position
DlgProgressBar.SetPos(CTRL_PROGRESS_BAR_01, PercentComplete);

-- Update the status text
if(ServerStatusMessage == "") then
-- We're downloading...

-- Shorten the TransferRate to 2 decimal places
local TransferRateFormatted = string.format("%.2f", TransferRate);

-- Display the elapsed time or time remaining
-- and the current transfer rate
if(FileSize > 0) then
-- We know the size of the file we're downloading
-- so use the estimated time remaining
local StatusText = TrueUpdate.GetLocalizedString("MSG_ESTIMATED_TIME_LEFT")..": "..EstimatedTimeRemaining.." - "..TrueUpdate.GetLocalizedString("MSG_TRANSFER_RATE")..": "..TransferRateFormatted.." "..TrueUpdate.GetLocalizedString("MSG_KB_PER_SEC");
--DlgStaticText.SetProperties(CTRL_STATICTEXT_LABEL_ 02, {Text=StatusText}); else
-- We don't know the size of the file we're downloading
-- so calculate the elapsed time
local SecondsElapsed = os.time() - screen_globals.TimeStarted;

-- from _TU20_Global_Functions.lua:
-- Translate the elapsed download time
-- into a formatted string ("mm:ss" or "hh:mm:ss")
local TimeElapsed = g_GetFormattedTime(SecondsElapsed);

local StatusText = TrueUpdate.GetLocalizedString("MSG_ELAPSED_TIME")..": "..TimeElapsed.." - "..TrueUpdate.GetLocalizedString("MSG_TRANSFER_RATE")..": "..TransferRateFormatted.." "..TrueUpdate.GetLocalizedString("MSG_KB_PER_SEC");
--DlgStaticText.SetProperties(CTRL_STATICTEXT_LABEL_ 02, {Text=StatusText}); end

else
-- We're waiting for the server...

-- Show the current status message
--DlgStaticText.SetProperties(CTRL_STATICTEXT_LABEL_ 02, {Text=ServerStatusMessage}); end

-- Tell the HTTP.Download (or HTTP.DownloadSecure) action to continue
return true;
end


---------------------------------------
-- Download the file from the website
---------------------------------------


-- Set up the HTTP basic authentication table
local tableBasicAuthData = nil;
if(screen_globals.UseBasicAuth) then
tableBasicAuthData = { UserName=screen_globals.AuthUsername, Password=screen_globals.AuthPassword };
end

-- Get the current date/time in seconds
-- (we'll use this as a reference point
-- to calculate the elapsed time)
screen_globals.TimeStarted = os.time();

-- Download the file using the appropriate protocal (HTTP or HTTPS)
if(screen_globals.UseSSL) then
HTTP.DownloadSecure(screen_globals.SourceURL, screen_globals.DestinationPath, screen_globals.TransferType, screen_globals.Timeout, screen_globals.Port, tableBasicAuthData, nil, HTTPDownloadCallback);
else
HTTP.Download(screen_globals.SourceURL, screen_globals.DestinationPath, screen_globals.TransferType, screen_globals.Timeout, screen_globals.Port, tableBasicAuthData, nil, HTTPDownloadCallback);
end

-- Get the error code so we can process it in the "On Finish" event
screen_globals.DownloadResult = Application.GetLastError();

jassing
10-29-2008, 08:25 AM
i'm 99.9% sure I've used the "stock" screen & call back on systems with IE6.

I'll fire up an ie6 machine later today and see what happens.
have you tried using
Debug.ShowWindow(true);
Debug.SetTraceMode(true);
right before calling HTTP.Download()?

when it crashes, does tu close or does it still have focus? ie: can you evaluate the lasterror in true update?

Andreas
10-29-2008, 09:09 AM
i'm 99.9% sure I've used the "stock" screen & call back on systems with IE6.

I'll fire up an ie6 machine later today and see what happens.
have you tried using
Debug.ShowWindow(true);
Debug.SetTraceMode(true);
right before calling HTTP.Download()?

when it crashes, does tu close or does it still have focus? ie: can you evaluate the lasterror in true update?


It have worked on IE6 machines earlier. I'm not sure if any recent securityupdate from microsoft has made any changes to wininet.dll?

I'll try the debug