@echo off

set uaccheck=0

:INSTALL
pushd %~dp0
Devcon.exe find *>"%temp%\hansung_dev_temp_drv_install.txt"

find "PCI\VEN_8086&DEV_2723" "%temp%\hansung_dev_temp_drv_install.txt">nul
if %ERRORLEVEL% EQU 0 (
	echo INTEL AX200
	cd AX200
	MSI_Launcher.exe
	goto END
)

find "PCI\VEN_8086^&DEV_2723" "%temp%\hansung_dev_temp_drv_install.txt">nul
if %ERRORLEVEL% EQU 0 (
	echo INTEL AX200
	cd AX200
	MSI_Launcher.exe
	goto END
)


find "PCI\VEN_14C3&DEV_0608" "%temp%\hansung_dev_temp_drv_install.txt">nul
if %ERRORLEVEL% EQU 0 (
	>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
	if '%errorlevel%' NEQ '0' ( goto UACAccess )

	echo Mediatek RZ608
	cd RZ608
	pnputil /add-driver "mtkwl6ex.inf" /install > nul
	echo Install Complete
	pause
	goto END
)

find "PCI\VEN_14C3^&DEV_0608" "%temp%\hansung_dev_temp_drv_install.txt">nul
if %ERRORLEVEL% EQU 0 (
	>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
	if '%errorlevel%' NEQ '0' ( goto UACAccess )

	echo Mediatek RZ608
	cd RZ608
	pnputil /add-driver "mtkwl6ex.inf" /install > nul
	echo Complete
	pause
	goto END
) else (
	echo 지원되는 장치가 없습니다
	pause
)

:END
del "%temp%\hansung_dev_temp_drv_install.txt"
exit

:UACAccess
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\uac_get_admin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\uac_get_admin.vbs"
"%temp%\uac_get_admin.vbs"
del "%temp%\uac_get_admin.vbs"
exit /b

goto INSTALL