laurin1 Posted February 28, 2011 Share Posted February 28, 2011 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: ErrorEvent Source: Application ErrorEvent Category: (100)Event ID: 1000Date: 2/28/2011Time: 7:57:46 AMUser: N/AComputer: DC05Description: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 Applicat0008: 69 6f 6e 20 46 61 69 6c ion Fail0010: 75 72 65 20 20 42 61 63 ure Bac0018: 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 crtdl0030: 6c 2e 64 6c 6c 20 34 2e l.dll 4.0038: 30 2e 31 31 38 33 2e 31 0.1183.10040: 20 61 74 20 6f 66 66 73 at offs0048: 65 74 20 30 30 30 30 63 et 0000c0050: 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('***********************************************************') ExitEndFuncThat 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 Link to comment Share on other sites More sharing options...
KaFu Posted February 28, 2011 Share Posted February 28, 2011 (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 February 28, 2011 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-13) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
laurin1 Posted February 28, 2011 Author Share Posted February 28, 2011 Ok:I use all of those exact calls (like If @OSArch = 'X64') in other scripts and they work fineI took the Wow64RevertWow64FsRedirection call out completely, still failsIt 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 eitherLuckily, 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 Link to comment Share on other sites More sharing options...
KaFu Posted February 28, 2011 Share Posted February 28, 2011 "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. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-13) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
laurin1 Posted February 28, 2011 Author Share Posted February 28, 2011 Yes, it does fail on all machines (Server 2003 only, one is x64, the others are all x86.) Keith Davis MCSA, ZCE, A+, N+ http://www.laurinkeithdavis.com Link to comment Share on other sites More sharing options...
laurin1 Posted February 28, 2011 Author Share Posted February 28, 2011 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 Link to comment Share on other sites More sharing options...
laurin1 Posted February 28, 2011 Author Share Posted February 28, 2011 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 Link to comment Share on other sites More sharing options...
laurin1 Posted February 28, 2011 Author Share Posted February 28, 2011 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 Link to comment Share on other sites More sharing options...
laurin1 Posted February 28, 2011 Author Share Posted February 28, 2011 Downloaded newest version of UnixTime.au3 and it works!. Keith Davis MCSA, ZCE, A+, N+ http://www.laurinkeithdavis.com Link to comment Share on other sites More sharing options...
trancexx Posted February 28, 2011 Share Posted February 28, 2011 (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 February 28, 2011 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
trancexx Posted February 28, 2011 Share Posted February 28, 2011 (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 February 28, 2011 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
laurin1 Posted February 28, 2011 Author Share Posted February 28, 2011 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 Link to comment Share on other sites More sharing options...
trancexx Posted February 28, 2011 Share Posted February 28, 2011 Sure, no problem. I'm glad to see that you learned how to properly compile your scripts. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
guinness Posted March 7, 2011 Share Posted March 7, 2011 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 UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now