 
//---------------------------------------------------------------------------
// The UnInstalling event is sent after the component Device Driver
// is uninstalled.
//---------------------------------------------------------------------------
export prototype DeviceDriver_UnInstalled();
function DeviceDriver_UnInstalled()
NUMBER OldValue;         
STRING szTmp[256];
begin               
	Sprintf(szTmp, "Maj=%d Min=%d", SYSINFO.nWinMajor, SYSINFO.nWinMinor); 
//	MessageBoxEx(szTmp, "DeviceDriver_UnInstalled Start!", INFORMATION);
	UninstallDriver();
	UninstallDriverFiles();      
	    
	if ( ((SYSINFO.nWinMajor == 5) && (SYSINFO.nWinMinor == 2)) || ((SYSINFO.nWinMajor == 6) && (SYSINFO.nWinMinor == 0))) then
		Wow64DisableWow64FsRedirection(&OldValue);
		DeleteFile ( WINSYSDIR ^ "drivers" ^ "snp2sxp.sys" );
		DeleteFile ( WINSYSDIR ^ "drivers" ^ "sncamd.sys" );
		Wow64RevertWow64FsRedirection(OldValue);
	endif;       
	Sprintf(szTmp, "Maj=%d Min=%d", SYSINFO.nWinMajor, SYSINFO.nWinMinor); 
//	MessageBoxEx(szTmp, "DeviceDriver_UnInstalled END!", INFORMATION);         

end;
//---------------------------------------------------------------------------
// The Installing event is sent after the component Device Driver
// is installed.
//---------------------------------------------------------------------------
 
export prototype DeviceDriver_Installed();
function DeviceDriver_Installed()
	NUMBER OldValue;
    NUMBER nResult;
    NUMBER hkResult, dwDisposition;
    NUMBER nValue;
begin              
	if ( ((SYSINFO.nWinMajor == 5) && (SYSINFO.nWinMinor == 2)) || ((SYSINFO.nWinMajor == 6) && (SYSINFO.nWinMinor == 0))) then
		Wow64DisableWow64FsRedirection(&OldValue);
		DeleteFile ( WINDIR ^ "SysWOW64" ^ "drivers" ^ "snp2sxp.sys" );
		DeleteFile ( WINDIR ^ "SysWOW64" ^ "drivers" ^ "sncamd.sys" );
		Wow64RevertWow64FsRedirection(OldValue);
	endif;
	
    UseDLL ( "Advapi32.dll" );
	if ( ((SYSINFO.nWinMajor == 5) && (SYSINFO.nWinMinor == 2)) || ((SYSINFO.nWinMajor == 6) && (SYSINFO.nWinMinor == 0))) then
    	nResult = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\SONIX\\PCCAM\\SNP2STD\\PIDS", 0, 0, 0, (KEY_ALL_ACCESS | KEY_WOW64_64KEY), 0, &hkResult, &dwDisposition);
    else
    	nResult = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\SONIX\\PCCAM\\SNP2STD\\PIDS", 0, 0, 0, KEY_ALL_ACCESS, 0, &hkResult, &dwDisposition);
    endif;	
    if (nResult == ERROR_SUCCESS) then
    	nValue = 0x0c45627c;
    	RegSetValueExA(hkResult, "VP00", 0, REG_DWORD, &nValue, 4);
    	nValue = 0x0c4562bc;
    	RegSetValueExA(hkResult, "VP01", 0, REG_DWORD, &nValue, 4);
    	nValue = 0x0c45628a;
    	RegSetValueExA(hkResult, "VP02", 0, REG_DWORD, &nValue, 4);
    	nValue = 0x0c456270;
    	RegSetValueExA(hkResult, "VP03", 0, REG_DWORD, &nValue, 4);
    	nValue = 0x0c4562b0;
    	RegSetValueExA(hkResult, "VP04", 0, REG_DWORD, &nValue, 4);
    	nValue = 0x0c456240;
    	RegSetValueExA(hkResult, "VP05", 0, REG_DWORD, &nValue, 4);
    	nValue = 0x0c456280;
    	RegSetValueExA(hkResult, "VP06", 0, REG_DWORD, &nValue, 4);
    	nValue = 0x0c456242;
    	RegSetValueExA(hkResult, "VP07", 0, REG_DWORD, &nValue, 4);
    	nValue = 0x0c456282;
    	RegSetValueExA(hkResult, "VP08", 0, REG_DWORD, &nValue, 4);
    	nValue = 0x0c45627b;
    	RegSetValueExA(hkResult, "VP09", 0, REG_DWORD, &nValue, 4);
    	nValue = 0x0c4562bb;
    	RegSetValueExA(hkResult, "VP10", 0, REG_DWORD, &nValue, 4);
      	nValue = 0x0c45624f;
    	RegSetValueExA(hkResult, "VP11", 0, REG_DWORD, &nValue, 4);
    	nValue = 0x0c45628f;
    	RegSetValueExA(hkResult, "VP12", 0, REG_DWORD, &nValue, 4);
    	nValue = 0x0c45627f;
    	RegSetValueExA(hkResult, "VP13", 0, REG_DWORD, &nValue, 4);
    	nValue = 0x0c45624e;
    	RegSetValueExA(hkResult, "VP14", 0, REG_DWORD, &nValue, 4);
    	nValue = 0x0c45628e;
    	RegSetValueExA(hkResult, "VP15", 0, REG_DWORD, &nValue, 4);  
     	nValue = 0x0c456243;
    	RegSetValueExA(hkResult, "VP16", 0, REG_DWORD, &nValue, 4);
    	nValue = 0x0c45624b;
    	RegSetValueExA(hkResult, "VP17", 0, REG_DWORD, &nValue, 4);
    	nValue = 0x0c45628b;
    	RegSetValueExA(hkResult, "VP18", 0, REG_DWORD, &nValue, 4);
    	nValue = 0x0c45627a;
    	RegSetValueExA(hkResult, "VP19", 0, REG_DWORD, &nValue, 4);
    	nValue = 0x0c4562ba;
    	RegSetValueExA(hkResult, "VP20", 0, REG_DWORD, &nValue, 4);   
     	nValue = 0x0c45628b;
    	RegSetValueExA(hkResult, "VP21", 0, REG_DWORD, &nValue, 4);  
     	nValue = 0x0c456283;
    	RegSetValueExA(hkResult, "VP22", 0, REG_DWORD, &nValue, 4);   	
     	nValue = 0x0c456260;
    	RegSetValueExA(hkResult, "VP23", 0, REG_DWORD, &nValue, 4);   
     	nValue = 0x0c4562a0;
    	RegSetValueExA(hkResult, "VP24", 0, REG_DWORD, &nValue, 4);    	
     	nValue = 0x0c456248;
    	RegSetValueExA(hkResult, "VP25", 0, REG_DWORD, &nValue, 4);   
     	nValue = 0x0c456288;
    	RegSetValueExA(hkResult, "VP26", 0, REG_DWORD, &nValue, 4); 
    	nValue = 0x0c45624c;
    	RegSetValueExA(hkResult, "VP27", 0, REG_DWORD, &nValue, 4);   
     	nValue = 0x0c45628c;
    	RegSetValueExA(hkResult, "VP28", 0, REG_DWORD, &nValue, 4); 	
   
    	RegCloseKey(hkResult);
    endif;
    
    // Tray-Icon related
	if ( ((SYSINFO.nWinMajor == 5) && (SYSINFO.nWinMinor == 2)) || ((SYSINFO.nWinMajor == 6) && (SYSINFO.nWinMinor == 0))) then
    	nResult = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\SONIX\\PCCAM\\SNP2STD", 0, 0, 0, (KEY_ALL_ACCESS | KEY_WOW64_64KEY), 0, &hkResult, &dwDisposition);
    else
    	nResult = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\SONIX\\PCCAM\\SNP2STD", 0, 0, 0, KEY_ALL_ACCESS, 0, &hkResult, &dwDisposition);
    endif;	
    if (nResult == ERROR_SUCCESS) then
    	nValue = 0;
    	RegSetValueExA(hkResult, "DisplaySelection", 0, REG_DWORD, &nValue, 4);
    	
    	RegCloseKey(hkResult);
    endif;
    UnUseDLL ( "Advapi32.dll" );
    
	UninstallDriver();
end;
//---------------------------------------------------------------------------
// The Installing event is sent after the component Must Component
// is installed.
//---------------------------------------------------------------------------
 
export prototype MustComponent_Installed();
function MustComponent_Installed()
	NUMBER OldValue;
begin
	if ( ((SYSINFO.nWinMajor == 5) && (SYSINFO.nWinMinor == 2)) || ((SYSINFO.nWinMajor == 6) && (SYSINFO.nWinMinor == 0))) then
		DeleteFile ( WINSYSDIR ^ "c" + IFX_PRODUCT_KEY + ".dll" );
		Wow64DisableWow64FsRedirection(&OldValue);
		CopyFile  ( SUPPORTDIR ^ "c" + IFX_PRODUCT_KEY + ".dll" , WINSYSDIR ^ "c" + IFX_PRODUCT_KEY + ".dll" );
		Wow64RevertWow64FsRedirection(OldValue);

	endif;
    if (Is ( FILE_EXISTS , WINDIR^"SysWOW64"^"csnp2std.dll" )) then
		Wow64DisableWow64FsRedirection(&OldValue);
	 	CopyFile  ( SUPPORTDIR ^ "c" + IFX_PRODUCT_KEY + ".dll" , WINDIR ^ "SysWOW64" ^ "c" + IFX_PRODUCT_KEY + ".dll" );
    	Wow64RevertWow64FsRedirection(OldValue);
    endif;


end;
//---------------------------------------------------------------------------
// The UnInstalling event is sent after the component Must Component
// is uninstalled.
//---------------------------------------------------------------------------
 
export prototype MustComponent_UnInstalled();
function MustComponent_UnInstalled()
	NUMBER OldValue;
begin
	if ( ((SYSINFO.nWinMajor == 5) && (SYSINFO.nWinMinor == 2)) || ((SYSINFO.nWinMajor == 6) && (SYSINFO.nWinMinor == 0))) then
		Wow64DisableWow64FsRedirection(&OldValue);
		DeleteFile ( WINSYSDIR ^ "c" + IFX_PRODUCT_KEY + ".dll" );
		Wow64RevertWow64FsRedirection(OldValue);
	endif;
end;
//---------------------------------------------------------------------------
// The UnInstalling event is sent just before the component 
// Device Driver is uninstalled.
//---------------------------------------------------------------------------
 
export prototype DeviceDriver_UnInstalling();
function DeviceDriver_UnInstalling()

begin 

end;