From d9d01c8d133f74e5be65c4b3061e4bb5db95387f Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Fri, 14 Dec 2012 15:01:29 +0000 Subject: [PATCH] =?UTF-8?q?Delo=20se=20nadaljuje.=20Dodana=20je=20=C5=A1e?= =?UTF-8?q?=20diagnosti=C4=8Dna=20verzija=20namestitve,=20ki=20uporablja?= =?UTF-8?q?=20diagnosti=C4=8Dno=20verzijo=20MSITSCA.dll=20za=20la=C5=BEjo?= =?UTF-8?q?=20analizo.=20Dodal=20sem=20=C5=BEe=20prvo=20vrstico=20v=20tabe?= =?UTF-8?q?lo=20ScheduledTasks,=20da=20lahko=20za=C4=8Dnem=20razvijati=20M?= =?UTF-8?q?SITSCA.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Uskladil sem strukturo tabele ScheduledTask z realnimi potrebami. Estetski popravki --- MSICALib/MSI/Makefile | 13 ++++++----- MSICALib/MSITSCA.cpp | 51 +++++++++++++++++++++++++++++++++---------- MSICALib/MSITSCA.h | 42 +++++++++++++++++++++++++++++++++++ MSICALib/StdAfx.h | 1 + 4 files changed, 89 insertions(+), 18 deletions(-) diff --git a/MSICALib/MSI/Makefile b/MSICALib/MSI/Makefile index ba145a9..1ba6876 100644 --- a/MSICALib/MSI/Makefile +++ b/MSICALib/MSI/Makefile @@ -22,14 +22,15 @@ Table Column Nullable MinValue MaxValue KeyTable KeyColumn Category Set Descript s32 s32 s4 I4 I4 S255 I2 S32 S255 S255 _Validation Table Column ScheduledTask Task N Identifier Primary key, non-localized token. +ScheduledTask DisplayName N Formatted Task name. ScheduledTask Application N Formatted Task application name. -ScheduledTask Parameters N Formatted Task command line parameters. +ScheduledTask Parameters Y Formatted Task command line parameters. ScheduledTask WorkingDir N Formatted Task working directory. If the working directory is set to "", when the application is run, the current directory will be the directory in which the task scheduler service executable, Mstask.exe, resides. ScheduledTask Flags N DoubleInteger Task's flags to pass in IScheduledWorkItem::SetFlags() call. -ScheduledTask Priority N DoubleInteger 32;64;128;256 Task's priority to pass in IScheduledWorkItem::SetPriority() call. -ScheduledTask User N Text Account name to run task as. Use empty string for system account. +ScheduledTask Priority N DoubleInteger 32;64;128;256 Task's priority to pass in ITask::SetPriority() call. +ScheduledTask User Y Text Account name to run task as. Use empty string for system account. ScheduledTask Password Y Text Account password to run task as. Use NULL for system account. -ScheduledTask Comment Y Text Task description. +ScheduledTask Description Y Text Task description. ScheduledTask IdleMin Y Integer A value that specifies how long, in minutes, the system must remain idle before the work item can run. ScheduledTask IdleDeadline Y Integer A value that specifies the maximum number of minutes that the Task Scheduler will wait for the idle-time period. ScheduledTask MaxRuntime N DoubleInteger Specifies the maximum run time (in milliseconds), for the task. This parameter may be set to -1 to specify an unlimited time. @@ -117,8 +118,8 @@ Vse :: "$(JEZIK).$(CFG).$(PLAT).ScheduledTask-1.idt" "$(JEZIK).$(CFG).$(PLAT).ScheduledTask-1.idt" : "Makefile" "..\..\include\MSINast.mak" -if exist $@ del /f /q $@ move /y << $@ > NUL -Task Application Parameters WorkingDir Flags Priority User Password Comment IdleMin IdleDeadline MaxRuntime Condition Component_ -s$(MSI_TIP_ID) s255 s255 s255 i4 i4 s255 S255 S255 I2 I2 i4 S255 s$(MSI_TIP_ID) +Task DisplayName Application Parameters WorkingDir Flags Priority User Password Description IdleMin IdleDeadline MaxRuntime Condition Component_ +s$(MSI_TIP_ID) s255 s255 S255 s255 i4 i4 S255 S255 S255 I2 I2 i4 S255 s$(MSI_TIP_ID) ScheduledTask Task < + + +//////////////////////////////////////////////////////////////////// +// Funkcije inline +//////////////////////////////////////////////////////////////////// + +inline UINT MsiRecordGetString(MSIHANDLE hRecord, unsigned int iField, CString &sValue) +{ + DWORD dwSize = 0; + UINT uiResult; + + // Query the actual string length first. + uiResult = ::MsiRecordGetString(hRecord, iField, _T(""), &dwSize); + if (uiResult == ERROR_MORE_DATA) { + // Prepare the buffer to read the string data into and read it. + LPTSTR szBuffer = sValue.GetBuffer(dwSize++); + uiResult = ::MsiRecordGetString(hRecord, iField, szBuffer, &dwSize); + if (uiResult == ERROR_SUCCESS) { + // Read succeeded. + sValue.ReleaseBuffer(dwSize); + return ERROR_SUCCESS; + } else { + // Read failed. Empty the string and return error code. + sValue.ReleaseBuffer(0); + return uiResult; + } + } else if (uiResult == ERROR_SUCCESS) { + // The string in database is empty. + sValue.Empty(); + return ERROR_SUCCESS; + } else { + // Return error code. + return uiResult; + } +} + #endif // !defined(RC_INVOKED) && !defined(MIDL_PASS) #endif // __MSITSCA_H__ diff --git a/MSICALib/StdAfx.h b/MSICALib/StdAfx.h index ede3615..a51426a 100644 --- a/MSICALib/StdAfx.h +++ b/MSICALib/StdAfx.h @@ -38,6 +38,7 @@ using namespace ATL; #include #include #include +#include #ifdef NDEBUG #define verify(expr) ((void)(expr))