Sign in to follow this  
Followers 0
laurin1

Failed Scrips - crtdll.dll

14 posts in this topic

I have a script that we use on several different machines. It's ran fine for years. Suddenly, we started getting this error:

Event Type: Error

Event Source: Application Error

Event Category: (100)

Event ID: 1000

Date: 2/28/2011

Time: 7:57:46 AM

User: N/A

Computer: DC05

Description:

Faulting application Backup.exe, version 3.3.6.1, faulting module crtdll.dll, version 4.0.1183.1, fault address 0x0000cd6d.For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Data:

0000: 41 70 70 6c 69 63 61 74 Applicat

0008: 69 6f 6e 20 46 61 69 6c ion Fail

0010: 75 72 65 20 20 42 61 63 ure Bac

0018: 6b 75 70 2e 65 78 65 20 kup.exe

0020: 33 2e 33 2e 36 2e 31 20 3.3.6.1

0028: 69 6e 20 63 72 74 64 6c in crtdl

0030: 6c 2e 64 6c 6c 20 34 2e l.dll 4.

0038: 30 2e 31 31 38 33 2e 31 0.1183.1

0040: 20 61 74 20 6f 66 66 73 at offs

0048: 65 74 20 30 30 30 30 63 et 0000c

0050: 64 36 64 d6d

The error itself is just annoying, as it appears to be after the script exits. However, today, I realized that the script is failing. The last thing the script does before it exits is this:

Func End() Local $sJobNameTemp If $bCommandLineExists Then  $sJobNameTemp = $CmdLine[1] EndIf MySQLNonQuery("UPDATE backup_monitor b " & _
  "SET b.is_running=0, modified_by=(SELECT id FROM users WHERE username='" & @UserName & "') " & _
  "WHERE b.server_name='" & @ComputerName & "' AND b.job_name='" & $sJobNameTemp & "'") If @OSArch = 'X64' Then  DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 0) EndIf WriteLog('***********************************************************') ExitEndFunc

That SQL call that is in the function is not working. There are many SQL calls in this script, but this is the only one not working.


Keith Davis

MCSA, ZCE, A+, N+

http://www.laurinkeithdavis.com

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

http://msdn.microsoft.com/en-us/library/aa365743(VS.85).aspx

"To restore file system redirection, call the Wow64RevertWow64FsRedirection function. Every successful call to the Wow64DisableWow64FsRedirection function must have a matching call to the Wow64RevertWow64FsRedirection function. This will ensure redirection is re-enabled and frees associated system resources."

Also maybe enclosing the call in

if StringInStr(@OSArch,"64") Then

might be safer.

Add this

ConsoleWrite("! " & TimerInit() & @TAB & @UserName & @TAB & @ComputerName & @TAB & $sJobNameTemp & @CRLF)

before the Query to check the input values.

And finally the forum search does not return anything for MySQLNonQuery() :), how should we know what you're doing inside that function?

Edited by KaFu

Share this post


Link to post
Share on other sites

Ok:

  • I use all of those exact calls (like If @OSArch = 'X64') in other scripts and they work fine
  • I took the Wow64RevertWow64FsRedirection call out completely, still fails
  • It appears to be failing WAY before this function, somewhere farther up in the script, because we are not getting the email that parses the log file either
Luckily, we use CVS and I'm looking at the changees made the day this began to fail, but they were simple changes that I can't seem to find the problem. What woudl help is to know what "could" cause ctrdll.dll to fail. I found absolutely zero about it on the Internet.

Keith Davis

MCSA, ZCE, A+, N+

http://www.laurinkeithdavis.com

Share this post


Link to post
Share on other sites

"CRTDLL means C Run Time Dynamic Link Library... These files contain common subroutines used by programs created with Microsoft Visual C." Hmmm, maybe a failed .NET framework update? Does it fail on all machines? Honestly just a wild guess without more code to look at.

Share this post


Link to post
Share on other sites

Here's something. The script works fine when running it non-compiled (from Scite with F5), but fails once compiled.


Keith Davis

MCSA, ZCE, A+, N+

http://www.laurinkeithdavis.com

Share this post


Link to post
Share on other sites

Strange. I'm not 100% on this, but it appears to be compiler related. My machine is Windows 7 x64. I compiled this same script on another machine (Server 2003 x64) and it works. Compiled on mine, it does not. FYI, I'm compiling as x86, not x64 AutoIt scripts.


Keith Davis

MCSA, ZCE, A+, N+

http://www.laurinkeithdavis.com

Share this post


Link to post
Share on other sites

Found the problem. I searched the forum for this .dll file and got zero results, but that search was incorrect:

This is the line that is failing:

WriteLog('RegRead for Log #' & $i & ': ' & $sLogReg & ' Day: ' & _

_StringFormatTime ('%d', $sLogReg) & ' Hour: ' & _StringFormatTime ('%H', $sLogReg) & _

' Min: ' & _StringFormatTime ('%M', $sLogReg), _

@ScriptLineNumber)

I am using the UDF named UnixTime.au3. It uses has function here:

Func _StringFormatTime($s_Format, $i_Timestamp = -1, $i_MaxLen = 255)

Local $struct_Time, $ptr_Time, $av_Time, $av_StrfTime

If $i_Timestamp = default OR $i_Timestamp < 0 Then

$i_Timestamp = _TimeGetStamp()

EndIf

$ptr_Time = DllCall('CrtDll.dll', 'ptr', 'localtime', 'long_ptr', $i_Timestamp)

If @error Then

SetError(99)

Return False

EndIf

$av_StrfTime = DllCall('CrtDll.dll', 'int', 'strftime', _

'str', '', _

'int', $i_MaxLen, _

'str', $s_Format, _

'ptr', $ptr_Time[0])

Return $av_StrfTime[1]

EndFunc


Keith Davis

MCSA, ZCE, A+, N+

http://www.laurinkeithdavis.com

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

No, that's not it.

If it works it's because of something else. I can tell because I have this special ability to tell if someone is faking (don't tell anyone).

...I'll check the file (issue) to see why did you do that.

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

You big....

Use msvcrt.dll instead of CrtDll.dll. That way it would work on both 32 and 64 bit supported systems and both versions of AutoIt.

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

You big....

Use msvcrt.dll instead of CrtDll.dll. That way it would work on both 32 and 64 bit supported systems and both versions of AutoIt.

I didn't write UnixTime, and I really don't want to re-write it. The new version works just fine, but thanks.


Keith Davis

MCSA, ZCE, A+, N+

http://www.laurinkeithdavis.com

Share this post


Link to post
Share on other sites

Sure, no problem.

I'm glad to see that you learned how to properly compile your scripts.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

So I took the informative advice from trancexx and modified this by changing CrtDll.dll to msvcrt.dll and using previous advice from about localtime & gmtime.

I take it that I don't need to change any of the DLL structure apart from the DLL itself?? :)

ConsoleWrite(_UTCStringToDate(1299501247) & @CRLF) ; Returns: 07/03/2011 12:34:07

Func _UTCStringToDate($iTimeStamp, $sFormat = "%d/%m/%Y %H:%M:%S", $iTimeZone = 1)
    Local $aTimeZone[3] = [2, "gmtime", "localtime"], $iLength = 255

    Local $aPtr = DllCall("msvcrt.dll", "ptr:cdecl", $aTimeZone[$iTimeZone], "long*", $iTimeStamp)
    If @error Then Return SetError(1, 1, -1)
    Local $aReturn = DllCall("msvcrt.dll", "int:cdecl", "strftime", _
            "str", "", _
            "int", $iLength, _
            "str", $sFormat, _
            "ptr", $aPtr[0])
    Return $aReturn[1]
EndFunc   ;==>_UTCStringToDate

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0