DonChunior Posted July 27, 2021 Share Posted July 27, 2021 I am still working on the UDF for for BITS (Background Intelligent Transfer Service). This time I have a problem with the implementation of the IBackgroundCopyJob::GetTimes method. My determined timestamps all have the date January 1, 1601, which is the start date for time calculation for the FILETIME structure. I do use the _Date_Time_FileTimeToSystemTime function to convert to a system time, but I must have made a mistake somewhere that I am not getting the correct, current timestamps. Here is a link to the current working state of the UDF:https://github.com/DonChunior/BITS-UDF/tree/GetTimes And with this sample code the problem can be reproduced: #include <BITS.au3> #include <Array.au3> Main() Func Main() Local $oBackgroundCopyManager = _BITS_Connect() Local $oJob = _BITS_BackgroundCopyManager_CreateJob($oBackgroundCopyManager, "Test_Job", $BG_JOB_TYPE_DOWNLOAD) _BITS_BackgroundCopyJob_AddFile($oJob, "http://ipv4.download.thinkbroadband.com/1GB.zip", "C:\Temp\1GB.zip") _BITS_BackgroundCopyJob_Resume($oJob) Sleep(10000) Local $aTimes = _BITS_BackgroundCopyJob_GetTimes($oJob) ConsoleWrite(_ArrayToString($aTimes) & @CRLF) _BITS_BackgroundCopyJob_Cancel($oJob) EndFunc As always, I appreciate any help! Link to comment Share on other sites More sharing options...
Danyfirex Posted July 27, 2021 Share Posted July 27, 2021 Hello I think is this way: Local $iSizeFILETIME = 2 * 4 Local $tFILETIME = DllStructCreate($tagFILETIME, DllStructGetPtr($tBG_JOB_TIMES) + ($iSizeFILETIME * 0)) ;FILETIME1 $tFILETIME = DllStructCreate($tagFILETIME, DllStructGetPtr($tBG_JOB_TIMES) + ($iSizeFILETIME * 1)) ;FILETIME2 $tFILETIME = DllStructCreate($tagFILETIME, DllStructGetPtr($tBG_JOB_TIMES) + ($iSizeFILETIME * 2)) ;FILETIME3 Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
DonChunior Posted July 27, 2021 Author Share Posted July 27, 2021 25 minutes ago, Danyfirex said: Hello I think is this way: Local $iSizeFILETIME = 2 * 4 Local $tFILETIME = DllStructCreate($tagFILETIME, DllStructGetPtr($tBG_JOB_TIMES) + ($iSizeFILETIME * 0)) ;FILETIME1 $tFILETIME = DllStructCreate($tagFILETIME, DllStructGetPtr($tBG_JOB_TIMES) + ($iSizeFILETIME * 1)) ;FILETIME2 $tFILETIME = DllStructCreate($tagFILETIME, DllStructGetPtr($tBG_JOB_TIMES) + ($iSizeFILETIME * 2)) ;FILETIME3 Saludos Thanks for trying, @Danyfirex. I implemented your idea in the following code to test it for the first FILESYSTEM structure - the creation time: Func _BITS_BackgroundCopyJob_GetTimes(Const ByRef $oBackgroundCopyJob) Local $tBG_JOB_TIMES = 0 Local $tFILETIME = 0 Local $tSYSTEMTIME = 0 Local $aTimes[3] = ["", "", ""] $tBG_JOB_TIMES = DllStructCreate($tagBG_JOB_TIMES) $oBackgroundCopyJob.GetProgress($tBG_JOB_TIMES) $tFILETIME = DllStructCreate($tagFILETIME, DllStructGetPtr($tBG_JOB_TIMES)) $tSYSTEMTIME = _Date_Time_FileTimeToSystemTime($tFILETIME) ConsoleWrite(_Date_Time_SystemTimeToDateTimeStr($tSYSTEMTIME, 1) & @CRLF) $tFILETIME = 0 $tBG_JOB_TIMES = 0 Return $aTimes EndFunc ;==>_BITS_BackgroundCopyJob_GetTimes Unfortunately the timestamp is still in the year 1601. 😞 Link to comment Share on other sites More sharing options...
Solution Danyfirex Posted July 27, 2021 Solution Share Posted July 27, 2021 You're using GetProgress in your code. 😅 Saludos DonChunior and TheXman 1 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
DonChunior Posted July 27, 2021 Author Share Posted July 27, 2021 12 minutes ago, Danyfirex said: You're using GetProgress in your code. 😅 Saludos Dear me, I am a fool. Let's just pretend it never happened ... 🙃 Thank you for the crucial hint! Link to comment Share on other sites More sharing options...
Danyfirex Posted July 27, 2021 Share Posted July 27, 2021 It happens to all of us 🤣 I'm getting some issue while creating the BackgroundCopyManager Instance. I get AutoIt stuck while creating "{4BD3E4E1-7BD4-4A2B-9964-496400DE5193}", _ ; BITS 10.1 instance. BITS 10.3 and BITS 10.2 fails correctly. but BITS 10.1 make my code get stuck forever in the ObjCreateInterface. I'll check deeply later. It's just to to let you know. Saludos DonChunior 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
DonChunior Posted July 27, 2021 Author Share Posted July 27, 2021 7 minutes ago, Danyfirex said: BITS 10.3 and BITS 10.2 fails correctly. but BITS 10.1 make my code get stuck forever in the ObjCreateInterface. I'll check deeply later. It's just to to let you know. Interesting. If you find out more, please share your findings with me. 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