home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 November / PCWNOV07.iso / shared / agentdui.cab / scui.dll / HTML / MPF.VBS < prev    next >
Encoding:
Text File  |  2005-07-27  |  15.5 KB  |  655 lines

  1. Option Explicit
  2. Const MPF_CLSID_MPFAGENT_STR = "{C3E5EA7D-6CC4-4344-84EF-2BA9B63F3519}"
  3. Const MPF_AGENT_MODULE_NAME_STR = "MPFAgent.exe"
  4. Const MPF_MVTX_MODULE_NAME_STR = "MVTX.exe"
  5. Const MPF_CMDARG_SHUTDOWN_STR = "/INVOKE:Shutdown"
  6. Const MPF_CMDARG_START_STR = "/INVOKE:StartFirewall"
  7. Const MPF_CMDARG_VWEVTLOG_SUMMARY_STR = "/INVOKE:View:Summary"
  8. Const MPF_CMDARG_VWEVTLOG_INBOUND_STR = "/INVOKE:View:Inbound"
  9. Const MPF_CMDARG_VWEVTLOG_APPLICATION_STR = "/INVOKE:View:Applications"
  10. Const MPF_CMDARG_VWEVTLOG_STR = "/INVOKE:View:Summary"
  11. Const MPF_CMDARG_SETSECURITY_DISABLE_STR = "/INVOKE:SetSecurity:Open"
  12. Const MPF_CMDARG_SETSECURITY_ENABLE_STR = "/INVOKE:SetSecurity:Standard"
  13. Const MPF_CMDARG_TESTMYFIREWALL_STR = "/INVOKE:TestFirewall"
  14. Const MPF_CMDARG_TRACKATTACK_STR = "/T:"
  15. Const MPF_CMDARG_OPTIONS_STR = "/INVOKE:ShowOptions:General"
  16. Const MPF_CMDARG_ABOUT_STR = "/INVOKE:About"
  17. Const MPF_CMDARG_VERIFYSUBSCRIPTION_STR = "/INVOKE:VerifySubscription"
  18.  
  19. Const MPF_MAINMODULE_STR = "MPFConsole.exe"
  20.  
  21. Const MPF_CMDARG_SETSECURITYLEVEL_STR = "/INVOKE:SetSecurity"
  22. Const MPF_SECLEVEL_OPEN_STR = "Open"
  23. Const MPF_SECLEVEL_TRUSTING_STR = "Trusting"
  24. Const MPF_SECLEVEL_STANDARD_STR = "Standard"
  25. Const MPF_SECLEVEL_TIGHT_STR = "Tight"
  26. Const MPF_SECLEVEL_LOCKDOWN_STR = "Lockdown"
  27.  
  28. 'Following Consts are required to check if perpetual product is installed...
  29. Const REG_MPF_KEY                 = "HKLM\Software\McAfee.com\Personal Firewall"
  30. Const REG_MPF_PRODUCTTYPE_NAME        = "ProductType"     '// Product information
  31. Const MPF_PRODUCT_INSTALL_TYPE_NODIE_NOUPDATES  = &H00000200
  32.  
  33. '0 == Application started
  34. '1 == Application could not be started
  35. Function LaunchProgram( szPath, szCmdLine, eResult )
  36. '{
  37.     eResult = 1
  38.  
  39.     If False = IsObject( g_localObjOS ) Then
  40.         LaunchProgram = eResult
  41.         Exit Function
  42.     End If
  43.  
  44.     If False = IsObject( g_localObjFS ) Then
  45.         LaunchProgram = eResult
  46.         Exit Function
  47.     End If
  48.  
  49.     If g_localObjOS is nothing Or _
  50.         g_localObjFS is nothing Then
  51.     '{
  52.         LaunchProgram = eResult
  53.         Exit Function
  54.     '}
  55.     End If
  56.  
  57.     If "" <> szPath And "" <> szCmdLine Then
  58.     '{
  59.         If 0 = g_localObjOS.RunProgram( szPath, CStr(szCmdLine) ) Then
  60.             eResult = 1
  61.         Else 
  62.             eResult = 0
  63.         End If
  64.     '}
  65.     End If
  66.     LaunchProgram = eResult
  67. '}
  68. End Function
  69.  
  70. Function SetSecurityLevel( szSecurityLevel )
  71. '{
  72.     Dim eResult 
  73.     Dim szPath
  74.     Dim szCmdLine
  75.     szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
  76.     szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
  77.     szCmdLine = MPF_CMDARG_SETSECURITYLEVEL_STR + ":" + szSecurityLevel
  78.     LaunchProgram szPath, szCmdLine, eResult 
  79. '}
  80. End Function
  81.  
  82. Function EnableMPF()
  83. '{
  84.     EnableMPF = -1
  85.  
  86.     If False = IsObject( g_localObjOS ) Or g_localObjOS is nothing Then
  87.         Exit Function
  88.     End If
  89.  
  90.     Dim eResult 
  91.     Dim szPath
  92.     szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
  93.     szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
  94.     LaunchProgram szPath, MPF_CMDARG_START_STR, eResult 
  95.  
  96.     'SetSecurityLevel MPF_SECLEVEL_STANDARD_STR
  97.  
  98.     EnableMPF = 0
  99. '}
  100. End Function
  101.  
  102. Function DisableMPF()
  103. '{
  104.     DisableMPF = -1
  105.  
  106.     If False = IsObject( g_localObjOS ) Or g_localObjOS is nothing Then
  107.         Exit Function
  108.     End If
  109.  
  110.     Dim eResult 
  111.     Dim szPath
  112.     szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
  113.     szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
  114.     LaunchProgram szPath, MPF_CMDARG_SHUTDOWN_STR, eResult 
  115.  
  116.     '// Check if process is running.
  117.     'SetSecurityLevel MPF_SECLEVEL_OPEN_STR 
  118.  
  119.     DisableMPF = 0
  120. '}
  121. End Function
  122.  
  123. Function ViewEventLogSummary()
  124. '{
  125.     Dim eResult 
  126.     Dim szPath
  127.     szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
  128.     szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
  129.     LaunchProgram szPath, MPF_CMDARG_VWEVTLOG_SUMMARY_STR, eResult 
  130. '}
  131. End Function
  132.  
  133. Function ViewEventLogInbound()
  134. '{
  135.     Dim eResult 
  136.     Dim szPath
  137.     szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
  138.     szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
  139.     LaunchProgram szPath, MPF_CMDARG_VWEVTLOG_INBOUND_STR, eResult 
  140. '}
  141. End Function
  142.  
  143. Function ViewEventLogApplications()
  144. '{
  145.     Dim eResult 
  146.     Dim szPath
  147.     szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
  148.     szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
  149.     LaunchProgram szPath, MPF_CMDARG_VWEVTLOG_APPLICATION_STR, eResult 
  150. '}
  151. End Function
  152.  
  153. Function TestMPF()
  154. '{
  155.     Dim eResult 
  156.     Dim szPath
  157.     szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
  158.     szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
  159.     LaunchProgram szPath, MPF_CMDARG_TESTMYFIREWALL_STR, eResult 
  160. '}
  161. End Function
  162.  
  163. Function IsMPFPlus()
  164. '{
  165.     '1 = Plus, 0 = Standard 
  166.     IsMPFPlus = 0
  167.  
  168.     If False = IsObject( g_localObjOS ) Or g_localObjOS is nothing Then
  169.         Exit Function
  170.     End If
  171.  
  172.     If False = IsObject( g_localObjReg ) Or g_localObjReg is nothing Then
  173.         Exit Function
  174.     End If
  175.  
  176.     Dim bOldOfuscate
  177.     bOldOfuscate = g_localObjReg.obfuscate
  178.  
  179.     g_localObjReg.obfuscate = FALSE
  180.  
  181.     Dim dwPlus
  182.     dwPlus = 0
  183.     dwPlus = g_localObjReg.RegQueryValue( CStr("HKLM\Software\McAfee.com\Personal Firewall"), CStr("Plus") )
  184.  
  185.     If 1 = dwPlus Then
  186.         IsMPFPlus = 1
  187.     End If
  188.  
  189.     g_localObjReg.obfuscate = bOldOfuscate
  190. '}
  191. End Function
  192.  
  193. Function TrackAnAttack()
  194. '{
  195.     Dim szIPAddr
  196.  
  197.     If IsMpfPlus() = 1 Then
  198.         '//szIPAddr = window.showModalDialog( "trckattk.htm", "", "dialogheight:225px; dialogwidth:324px; center:yes; resizable:no; status:no; help:no; edge:raised;" )
  199.         szIPAddr = window.showModalDialog( "trckattk.htm", "", "dialogheight:225px; dialogwidth:303px; center:yes; resizable:no; status:no; help:no; edge:raised;" )
  200.     Else
  201.         szIPAddr = "Standard"
  202.     End If
  203.  
  204.     If "" <> szIPAddr Then
  205.     '{
  206.         Dim eResult 
  207.         Dim szPath
  208.         Dim szCmdLine
  209.         szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
  210.         szPath = CStr(szPath & "\" & MPF_MVTX_MODULE_NAME_STR)
  211.         szCmdLine = MPF_CMDARG_TRACKATTACK_STR + szIPAddr
  212.         LaunchProgram szPath, szCmdLine, eResult 
  213.     '}
  214.     End If
  215. '}
  216. End Function
  217.  
  218. Function ShowOptions()
  219. '{
  220.     Dim eResult 
  221.     Dim szPath
  222.     Dim szCmdLine
  223.     szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
  224.     szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
  225.     LaunchProgram szPath, MPF_CMDARG_OPTIONS_STR, eResult 
  226. '}
  227. End Function
  228.  
  229. Function ShowAbout()
  230. '{
  231.     Dim eResult 
  232.     Dim szPath
  233.     Dim szCmdLine
  234.     szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
  235.     szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
  236.  
  237.     LaunchProgram szPath, MPF_CMDARG_ABOUT_STR, eResult 
  238. '}
  239. End Function
  240.  
  241. '////////////////////////////////////////////////////////////////////////
  242. 'Functions doing the actual work may or may not have return values. But we don't want
  243. 'to return anything. So following wrapper functions are added...
  244.  
  245. Function IsMPFEnabled()
  246. '{
  247.     '-1 = Error, 0 = Not Running/Disabled, 1 = Enabled, 2 = Open
  248.     IsMPFEnabled = -1
  249.  
  250.     If False = IsObject( g_localObjOS ) Or g_localObjOS is nothing Then
  251.         Exit Function
  252.     End If
  253.  
  254.     If False = IsObject( g_localObjReg ) Or g_localObjReg is nothing Then
  255.         Exit Function
  256.     End If
  257.  
  258.     Dim bOldOfuscate
  259.     bOldOfuscate = g_localObjReg.obfuscate
  260.  
  261.     g_localObjReg.obfuscate = FALSE
  262.  
  263.     Dim dwSecurityLevel
  264.     dwSecurityLevel = -1
  265.     dwSecurityLevel = g_localObjReg.RegQueryValue( CStr("HKLM\Software\McAfee.com\Personal Firewall"), CStr("Security") )
  266.     If 0 = dwSecurityLevel Then
  267.     '{
  268.         ' MPF is running but securitylevel set to "open"
  269.         IsMPFEnabled = 2
  270.     '}
  271.     ElseIf dwSecurityLevel >= 1 And dwSecurityLevel <= 4 Then
  272.     '{
  273.         ' MPF is running and protecting
  274.         IsMPFEnabled = 1
  275.     '}
  276.     Else 'If 255 = dwSecurityLevel Then
  277.     '{
  278.         ' MPF is not running
  279.         IsMPFEnabled = 0
  280.     '}
  281.     End If
  282.  
  283.     g_localObjReg.obfuscate = bOldOfuscate
  284. '}
  285. End Function
  286.  
  287. Function OnEnableMPF()
  288. '{
  289.     EnableMPF()
  290.  
  291.     'Now we have a Timer that calls GetNewMPFState every 1500 msec
  292.     'which in turn calls these functions, so we don't need to call it here...
  293.     'SetDocumentTitleString()
  294. '}
  295. End Function
  296.  
  297. Function OnDisableMPF()
  298. '{
  299.     DisableMPF()
  300.  
  301.     'Now we have a Timer that calls GetNewMPFState every 1500 msec
  302.     'which in turn calls these functions, so we don't need to call it here...
  303.     'SetDocumentTitleString()
  304. '}
  305. End Function
  306.  
  307. Function OnSetStdSecLevel()
  308. '{
  309.     SetSecurityLevel MPF_SECLEVEL_STANDARD_STR
  310. '}
  311. End Function
  312.  
  313. Function OnVerifyMPF()
  314. '{
  315.     Dim eResult 
  316.     Dim szPath
  317.     Dim szCmdLine
  318.     szPath = GetObjectPath( MPF_CLSID_MPFAGENT_STR, g_localObjOS, g_localObjFS )
  319.     szPath = CStr(szPath & "\" & MPF_AGENT_MODULE_NAME_STR)
  320.  
  321.     LaunchProgram szPath, MPF_CMDARG_VERIFYSUBSCRIPTION_STR, eResult 
  322. '}
  323. End Function
  324.  
  325. Function OnViewEventLogSummary()
  326. '{
  327.     ViewEventLogSummary()
  328. '}
  329. End Function
  330.  
  331. Function OnViewEventLogInbound()
  332. '{
  333.     ViewEventLogInbound()
  334. '}
  335. End Function
  336.  
  337. Function OnViewEventLogApplications()
  338. '{
  339.     ViewEventLogApplications()
  340. '}
  341. End Function
  342.  
  343.  
  344. Function OnTestMPF()
  345. '{
  346.     TestMPF()
  347. '}
  348. End Function
  349.  
  350. Function OnTrackAnAttack()
  351. '{
  352.     TrackAnAttack()
  353. '}
  354. End Function
  355.  
  356. Function OnShowOptions()
  357. '{
  358.     ShowOptions()
  359. '}
  360. End Function
  361.  
  362. Function OnShowAbout()
  363. '{
  364.     ShowAbout()
  365. '}
  366. End Function
  367.  
  368.  
  369. Function GetInstalledMPFVersion( objReg, objOS, objFS )
  370. '{
  371.     'objReg Object has Obfuscate set to TRUE
  372.     'objOS is Operating Sysytem object
  373.     'objFS is File System object
  374.  
  375.     Const CLSID_MPF_2_X =  "{06B8EBA6-9D9E-4cea-9301-AF7D3363E1FD}"
  376.     Const CLSID_MPF_4_X =  "{C3E5EA7D-6CC4-4344-84EF-2BA9B63F3519}"
  377.  
  378.     GetInstalledMPFVersion = -1
  379.  
  380.     If False = IsObject( objOS ) Then
  381.         Exit Function
  382.     End If
  383.  
  384.     If False = IsObject( objFS ) Then
  385.         Exit Function
  386.     End If
  387.  
  388.     If objOS is nothing Or _
  389.         objFS is nothing Then
  390.     '{
  391.         Exit Function
  392.     '}
  393.     End If
  394.  
  395.     Dim szPath
  396.     szPath = GetObjectPath( CLSID_MPF_2_X, objOS, objFS )
  397.     If "" <> szPath Then
  398.     '{
  399.         szPath = szPath & CStr("\mpf.exe")
  400.         If True = objFS.IsFile( szPath ) Then
  401.         '{
  402.             'MPF 2.X is installed...
  403.  
  404.             GetInstalledMPFVersion = 2
  405.  
  406.             Exit Function
  407.         '}
  408.         End If
  409.     '}
  410.     End If
  411.  
  412.     szPath = GetObjectPath( CLSID_MPF_4_X, objOS, objFS )
  413.     If "" <> szPath Then
  414.     '{
  415.         szPath = szPath + "\" + MPF_AGENT_MODULE_NAME_STR
  416.         If True = objFS.IsFile( szPath ) Then
  417.         '{
  418.             'MPF 4.X is installed...
  419.  
  420.             GetInstalledMPFVersion = 4
  421.  
  422.             Exit Function
  423.         '}
  424.         End If
  425.     '}
  426.     End If
  427.  
  428.     'Neither 2.X nor 4.X is installed, Check if 3.X is installed by checking
  429.     'file version of MPF_MAINMODULE_STR
  430.     'Get Install Dir from the registry...
  431.  
  432.     Dim eResult
  433.  
  434.     'NO OBFUSCATION REQUIRED HERE...
  435.     Dim prevObfuscateVal
  436.     prevObfuscateVal = objReg.obfuscate
  437.  
  438.     objReg.obfuscate = FALSE
  439.  
  440.     szPath = objReg.RegQueryValue( CStr("HKLM\Software\McAfee.com\Personal Firewall"), CStr("Install Dir") )
  441.  
  442.     'Reset previous obfuscate value...
  443.     objReg.obfuscate = prevObfuscateVal
  444.  
  445.     If "" <> szPath Then
  446.     '{
  447.         szPath = szPath + "\" + MPF_MAINMODULE_STR
  448.  
  449.         eResult = objOS.CheckVersion( szPath, "4,0,0,0" )
  450.         'CheckVersion returns MCINST_OS_OLDER_VERSION_EXISTS (1) if older version (3) exists... 
  451.         If 1 = eResult Then
  452.             GetInstalledMPFVersion = 3
  453.             Exit Function
  454.         End If
  455.     '}
  456.     Else
  457.         Exit Function
  458.     End If
  459. '}
  460. End Function
  461.  
  462. '1 = Expired, 0 = Not Expired
  463. Function IsMPFExpired()
  464. '{
  465.     Dim    szExpDate
  466.  
  467.     If g_localObjInstaller is nothing Or Not IsObject( g_localObjInstaller ) Then
  468.         IsMPFExpired = 1
  469.         Exit Function
  470.     End If
  471.         
  472.     ' If Product type says its perpetual product return not expired...        
  473.     If False = WillMPFProductExpire() Then
  474.         IsMPFExpired = 0
  475.         Exit Function
  476.     End If
  477.     
  478.     szExpDate = ""
  479.     g_localObjInstaller.GetExpiryDate "HKLM\Software\McAfee.com\Personal Firewall", "Settings", szExpDate 
  480.  
  481.     If Len(szExpDate) <> 8 Then
  482.         IsMPFExpired = 1
  483.         Exit Function
  484.     End If
  485.  
  486.     Dim szExpYear, szExpMonth, szExpDay
  487.     szExpYear = Left( szExpDate, 4 )
  488.     szExpMonth = Mid( szExpDate, 5, 2 )
  489.     szExpDay = Mid( szExpDate, 7, 2)
  490.  
  491.     Dim glExpYear, glExpMonth, glExpDay
  492.  
  493.     glExpYear  = CStr( szExpYear )
  494.     glExpMonth = CStr( szExpMonth )
  495.     glExpDay   = CStr( szExpDay )
  496.  
  497.     Dim actualExpiryDate
  498.     actualExpiryDate = DateSerial( glExpYear, glExpMonth, glExpDay )
  499.  
  500.     If False = IsDate( actualExpiryDate ) Then
  501.     '{
  502.         'Tampered Expiry setting
  503.         IsMPFExpired = 1
  504.         Exit Function
  505.     '}
  506.     End If
  507.  
  508.     If DateDiff( "d", Date, actualExpiryDate ) >= 0 Then
  509.         IsMPFExpired = 0
  510.     Else
  511.         IsMPFExpired = 1
  512.     End If
  513.         
  514. '}
  515. End Function
  516.  
  517. Function WillMPFProductExpire()
  518. '{
  519.   Dim sTemp
  520.  
  521.   WillMPFProductExpire = True
  522.  
  523.   If IsObject(gobjReg) Then
  524.   '{
  525.     If not gobjReg is nothing Then
  526.     '{
  527.       gobjReg.Obfuscate = True
  528.       
  529.         sTemp = Trim(gobjReg.RegQueryValue(REG_MPF_KEY, REG_MPF_PRODUCTTYPE_NAME))
  530.         If IsNumeric(sTemp) And Len(sTemp) > 0 Then
  531.           If (CLng(sTemp) And MPF_PRODUCT_INSTALL_TYPE_NODIE_NOUPDATES) <> 0 Then
  532.             WillMPFProductExpire = False
  533.           End If
  534.         End If
  535.  
  536.       gobjReg.Obfuscate = False
  537.     '}
  538.     End If
  539.   '}
  540.   End If
  541. '}
  542. End Function
  543.  
  544.  
  545. '--------------------------------------------------------------------------------
  546. ' To Support Retail products in Dashboard, we need to have a set of function
  547. ' that check for Retail product state (Expired/Enabled/Disabled) etc
  548.  
  549. '1 = Installed, 0 = Not Installed, -1 = Error
  550. Function IsRetailMPFInstalled()
  551. '{
  552.     Dim bOldOfuscate, bRetail
  553.     If g_localObjReg Is Nothing Then
  554.         IsRetailMPFInstalled = -1
  555.         Exit Function
  556.     End If
  557.  
  558.     bRetail = 0
  559.     bOldOfuscate = g_localObjReg.obfuscate
  560.     g_localObjReg.obfuscate = True
  561.     bRetail = g_localObjReg.RegQueryValue( CStr("HKLM\Software\McAfee.com\Agent\Apps\MPF"), CStr("Retail") )
  562.     If 1 = bRetail Then
  563.         IsRetailMPFInstalled = 1
  564.     Else
  565.         IsRetailMPFInstalled = 0
  566.     End If
  567.     g_localObjReg.obfuscate = bOldOfuscate
  568. '}
  569. End Function
  570.  
  571. '1 = Expired, 0 = Not Expired
  572. Function IsRetailMPFExpired()
  573. '{
  574.     Dim    szExpDate
  575.  
  576.     If g_localObjInstaller is nothing Or Not IsObject( g_localObjInstaller ) Then
  577.         IsRetailMPFExpired = 1
  578.         Exit Function
  579.     End If
  580.  
  581.     ' If Product type says its perpetual product return not expired...        
  582.     If False = WillMPFProductExpire() Then
  583.         IsRetailMPFExpired = 0
  584.         Exit Function
  585.     End If
  586.  
  587.     szExpDate = ""
  588.     g_localObjInstaller.GetExpiryDate "HKLM\Software\McAfee.com\Personal Firewall", "Settings", szExpDate 
  589.  
  590.     If Len(szExpDate) <> 8 Then
  591.         IsRetailMPFExpired = 1
  592.         Exit Function
  593.     End If
  594.  
  595.     Dim szExpYear, szExpMonth, szExpDay
  596.     szExpYear = Left( szExpDate, 4 )
  597.     szExpMonth = Mid( szExpDate, 5, 2 )
  598.     szExpDay = Mid( szExpDate, 7, 2)
  599.  
  600.     Dim glExpYear, glExpMonth, glExpDay
  601.  
  602.     glExpYear  = CStr( szExpYear )
  603.     glExpMonth = CStr( szExpMonth )
  604.     glExpDay   = CStr( szExpDay )
  605.  
  606.     Dim actualExpiryDate
  607.     actualExpiryDate = DateSerial( glExpYear, glExpMonth, glExpDay )
  608.  
  609.     If False = IsDate( actualExpiryDate ) Then
  610.     '{
  611.         'Tampered Expiry setting
  612.         IsRetailMPFExpired = 1
  613.         Exit Function
  614.     '}
  615.     End If
  616.  
  617.     If DateDiff( "d", Date, actualExpiryDate ) >= 0 Then
  618.         IsRetailMPFExpired = 0
  619.     Else
  620.         IsRetailMPFExpired = 1
  621.     End If
  622.         
  623. '}
  624. End Function
  625.  
  626. '// 
  627. '// IsRetailMPFEnabled(): Return Values.
  628. '//
  629. '// -1: Error Code
  630. '// 0: Application is not running
  631. '// 1: Application is running.
  632. Function IsRetailMPFEnabled()
  633. '{
  634.     Dim bOldOfuscate, dwState
  635.     If g_localObjReg Is Nothing Then
  636.         IsRetailMPFEnabled = -1
  637.         Exit Function
  638.     End If
  639.  
  640.     dwState = 0
  641.     bOldOfuscate = g_localObjReg.obfuscate
  642.     g_localObjReg.obfuscate = True
  643.     dwState = g_localObjReg.RegQueryValue( CStr("HKLM\Software\McAfee.com\Agent\Apps\MPF"), CStr("State") )
  644.     If 1 = dwState Then
  645.         IsRetailMPFEnabled = 1
  646.     Else
  647.         IsRetailMPFEnabled = 0
  648.     End If
  649.     g_localObjReg.obfuscate = bOldOfuscate
  650. '}
  651. End Function
  652.  
  653. '--------------------------------------------------------------------------------
  654.  
  655.