diff options
Diffstat (limited to 'res/ATFBlast_ALL/userport')
16 files changed, 0 insertions, 1429 deletions
diff --git a/res/ATFBlast_ALL/userport/UserPort/Examples/IOPort.c b/res/ATFBlast_ALL/userport/UserPort/Examples/IOPort.c deleted file mode 100644 index 7cef182..0000000 --- a/res/ATFBlast_ALL/userport/UserPort/Examples/IOPort.c +++ /dev/null @@ -1,76 +0,0 @@ -#include <windows.h> -static BOOL bPrivException = FALSE; - -void outport(UINT portid, UINT value) -{ - __asm mov edx,portid; - __asm mov eax,value; - __asm out dx,ax; -} -void outportb(UINT portid, BYTE value) -{ - __asm mov edx,portid - __asm mov al,value - __asm out dx,al -} - -BYTE inportb(UINT portid) -{ - unsigned char value; - - __asm mov edx,portid - __asm in al,dx - __asm mov value,al - return value; -} - -UINT inport(UINT portid) -{ - int value=0; - __asm mov edx,portid - __asm in ax,dx - __asm mov value,eax - return value; -} - -LONG WINAPI HandlerExceptionFilter ( EXCEPTION_POINTERS *pExPtrs ) -{ - - if (pExPtrs->ExceptionRecord->ExceptionCode == EXCEPTION_PRIV_INSTRUCTION) - { - pExPtrs->ContextRecord->Eip ++; // Skip the OUT or IN instruction that caused the exception - bPrivException = TRUE; - return EXCEPTION_CONTINUE_EXECUTION; - } - else - return EXCEPTION_CONTINUE_SEARCH; -} - -BOOL StartUpIoPorts(UINT PortToAccess, BOOL bShowMessageBox, HWND hParentWnd) -{ - HANDLE hUserPort; - - hUserPort = CreateFile("\\\\.\\UserPort", GENERIC_READ, 0, NULL,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - CloseHandle(hUserPort); // Activate the driver - Sleep(100); // We must make a process switch - - SetUnhandledExceptionFilter(HandlerExceptionFilter); - - bPrivException = FALSE; - inportb(PortToAccess); // Try to access the given port address - - if (bPrivException) - { - if (bShowMessageBox) - { - MessageBox(hParentWnd,"Privileged instruction exception has occured!\r\n\r\n" - "To use this program under Windows NT or Windows 2000\r\n" - "you need to install the driver 'UserPort.SYS' and grant\r\n" - "access to the ports used by this program.", - NULL,MB_OK); - } - return FALSE; - } - return TRUE; -} - diff --git a/res/ATFBlast_ALL/userport/UserPort/Examples/IOPort.h b/res/ATFBlast_ALL/userport/UserPort/Examples/IOPort.h deleted file mode 100644 index 2fd3bf9..0000000 --- a/res/ATFBlast_ALL/userport/UserPort/Examples/IOPort.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef IOPORTH -#define IOPORTH - -#ifdef __cplusplus -extern "C" { -#endif - -void outport(UINT portid, UINT value); -void outportb(UINT portid, BYTE value); -BYTE inportb(UINT portid); -UINT inport(UINT portid); -BOOL StartUpIoPorts(UINT PortToAccess, BOOL bShowMessageBox, HWND hParentWnd); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/res/ATFBlast_ALL/userport/UserPort/Examples/IOPort.pas b/res/ATFBlast_ALL/userport/UserPort/Examples/IOPort.pas deleted file mode 100644 index 941240c..0000000 --- a/res/ATFBlast_ALL/userport/UserPort/Examples/IOPort.pas +++ /dev/null @@ -1,72 +0,0 @@ -unit IOPort; - -interface -uses windows; - -procedure outport(portid : integer; value : integer); -procedure outportb(portid : integer; value : BYTE); -function inportb(portid : integer) : byte; -function inport(portid : integer) : integer; -function StartUpIoPorts(PortToAccess : integer) : boolean; - -implementation - -var - bPrivException : boolean; - -procedure outport(portid : integer; value : integer); -Begin - asm - mov edx,portid; - mov eax,value; - out dx,ax; - end; -end; - -procedure outportb(portid : integer; value : BYTE); -Begin - asm - mov edx,portid - mov al,value - out dx,al - end; -end; - -function inportb(portid : integer) : byte; -Var value : byte; -Begin - asm - mov edx,portid - in al,dx - mov value,al - end; - inportb := value; -end; - -function inport(portid : integer) : integer; -Var value : integer; -Begin - value := 0; - asm - mov edx,portid - in ax,dx - mov value,eax - end; - inport := value; -end; - -function StartUpIoPorts(PortToAccess : integer) : boolean; -Var hUserPort : THandle; -Begin - hUserPort := CreateFile('\\.\UserPort', GENERIC_READ, 0, nil,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); - CloseHandle(hUserPort); // Activate the driver - Sleep(100); // We must make a process switch - - try - inportb(PortToAccess); // Try to access the given port address - except - MessageBox(0,'fel','fel',MB_OK); - end; -end; - -end.
\ No newline at end of file diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort.exe b/res/ATFBlast_ALL/userport/UserPort/UserPort.exe Binary files differdeleted file mode 100644 index ff018b1..0000000 --- a/res/ATFBlast_ALL/userport/UserPort/UserPort.exe +++ /dev/null diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort.pdf b/res/ATFBlast_ALL/userport/UserPort/UserPort.pdf Binary files differdeleted file mode 100644 index 590b378..0000000 --- a/res/ATFBlast_ALL/userport/UserPort/UserPort.pdf +++ /dev/null diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort.sys b/res/ATFBlast_ALL/userport/UserPort/UserPort.sys Binary files differdeleted file mode 100644 index 30ad74f..0000000 --- a/res/ATFBlast_ALL/userport/UserPort/UserPort.sys +++ /dev/null diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/Resource.h b/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/Resource.h deleted file mode 100644 index 46cfc3f..0000000 --- a/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/Resource.h +++ /dev/null @@ -1,30 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by UserPort.rc -// -#define IDD_USERPORT 101 -#define IDI_APP 102 -#define IDC_AUMP_LIST_GRANTS 1000 -#define IDC_AUMP_EDIT_ADD 1001 -#define IDC_AUMP_BUTTON_ADD 1002 -#define IDC_AUMP_BUTTON_REMOVE 1003 -#define IDC_TCF_EDIT_ADD 1004 -#define IDC_BUTTON_UPDATE 1009 -#define IDC_BUTTON_START 1010 -#define IDC_TCF_LIST_GRANTS 1011 -#define IDC_TCF_BUTTON_ADD 1012 -#define IDC_BUTTON_STOP 1013 -#define IDC_AUMP_BUTTON_DEFAULTS 1016 -#define IDC_TCF_BUTTON_REMOVE 1017 -#define IDC_TCF_BUTTON_DEFAULTS 1018 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1017 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.c b/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.c deleted file mode 100644 index 5129ae5..0000000 --- a/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.c +++ /dev/null @@ -1,512 +0,0 @@ -#include <windows.h> -#include <string.h> -#include "resource.h" - -char szDriverFileName[MAX_PATH]; -char DriverName[]="UserPort"; -HWND hDlg; - -unsigned Chars2Hex (char ch, unsigned oldval) -{ - int nHex; - - if ((ch>='0') && (ch<='9')) - nHex=ch-'0'; - else if ((ch>='a') && (ch<='f')) - nHex=ch-'a'+10; - else if ((ch>='A') && (ch<='F')) - nHex=ch-'A'+10; - else - return oldval; - return oldval*16+nHex; -} - -void UpperString(char *Str) -{ - int i,Len; - - Len=strlen(Str); - for (i=0;i<Len;i++) - if (Str[i]>'Z') - Str[i]-=32; -} - -BOOL StopDriver() -{ - SC_HANDLE schService; - SC_HANDLE schSCManager; - SERVICE_STATUS serviceStatus; - - - schSCManager = OpenSCManager (NULL, // machine (NULL == local) - NULL, // database (NULL == default) - SC_MANAGER_ALL_ACCESS // access required - ); - if (schSCManager == NULL) - { - return FALSE; - } - - schService = OpenService (schSCManager, - DriverName, - SERVICE_ALL_ACCESS - ); - - if (schService == NULL) - { - CloseServiceHandle (schSCManager); - return FALSE; - } - - ControlService (schService, SERVICE_CONTROL_STOP, &serviceStatus); - - DeleteService (schService); - - CloseServiceHandle (schService); - CloseServiceHandle (schSCManager); - return TRUE; -} - -BOOL StartDriver() -{ - SC_HANDLE schService = NULL; - SC_HANDLE schSCManager; - HANDLE hDriver; - DWORD LastError; - char szMess[300]; - char szTmp[MAX_PATH]; - - lstrcpy(szTmp,szDriverFileName); - szTmp[12] = '\0'; - if (lstrcmpi(szTmp,"\\SystemRoot\\")==0) - { - GetWindowsDirectory(szTmp,sizeof(szTmp)); - lstrcat(szTmp,szDriverFileName+11); - } - else - lstrcpy(szTmp,szDriverFileName); - - - hDriver = CreateFile (szTmp, - GENERIC_READ, - 0, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL - ); - if (hDriver==INVALID_HANDLE_VALUE) - { - wsprintf(szMess,"Driver does not exist:\r\n%s",szTmp); - MessageBox(hDlg,szMess,"UserPort",MB_OK); - return FALSE; - } - - CloseHandle(hDriver); - - schSCManager = OpenSCManager (NULL, // machine (NULL == local) - NULL, // database (NULL == default) - SC_MANAGER_ALL_ACCESS // access required - ); - - if (schSCManager == NULL) - { - if (GetLastError() == ERROR_ACCESS_DENIED) - MessageBox(hDlg,"You are not authorized to install drivers.\r\nPlase contact your administrator.","UserPort",MB_OK); - else - MessageBox(hDlg,"Unable to start driver!","UserPort",MB_OK); - - return FALSE; - } - - schService = CreateService (schSCManager, // SCManager database - DriverName, // name of service - DriverName, // name to display - SERVICE_START,//SERVICE_ALL_ACCESS, // desired access - SERVICE_KERNEL_DRIVER, // service type - SERVICE_SYSTEM_START, // start type - SERVICE_ERROR_NORMAL, // error control type - szDriverFileName, // service's binary - NULL, // no load ordering group - NULL, // no tag identifier - NULL, // no dependencies - NULL, // LocalSystem account - NULL // no password - ); - - if (schService == NULL) - { - LastError = GetLastError(); - if (LastError == ERROR_SERVICE_EXISTS) - MessageBox(hDlg,"Driver already started!","UserPort",MB_OK); - else if (LastError == ERROR_ACCESS_DENIED) - MessageBox(hDlg,"You are not authorized to install drivers.\r\nPlase contact your administrator.","UserPort",MB_OK); - else - MessageBox(hDlg,"Unable to start driver!","UserPort",MB_OK); - - CloseServiceHandle (schSCManager); - return FALSE; - } - - StartService (schService, // service identifier - 0, // number of arguments - NULL // pointer to arguments - ); - - CloseServiceHandle (schService); - CloseServiceHandle (schSCManager); - return TRUE; -} - -BOOL GetStartAndStopAddress(char *szStr, unsigned *nStartAddress, unsigned *nStopAddress) -{ - unsigned i, nStart = 0, nStop = 0; - - for (i=0;(szStr[i]!='\0')&&(szStr[i]!='-');i++) - nStart = Chars2Hex(szStr[i], nStart); - - if (szStr[i]=='\0') - return FALSE; - - for (i++;(szStr[i]!='\0')&&(szStr[i]!='-');i++) - nStop = Chars2Hex(szStr[i], nStop); - - *nStartAddress = nStart; - *nStopAddress = nStop; - - if (nStop < nStart) - return FALSE; - if (nStop > 0x3ff) - return FALSE; - - return TRUE; -} - -BOOL AddAUMPBtn() -{ - char szTemp[256]; - char szTemp2[256]; - unsigned nStartAddress,nStopAddress; - - GetDlgItemText(hDlg,IDC_AUMP_EDIT_ADD,szTemp,sizeof(szTemp)); - - if (!GetStartAndStopAddress(szTemp, &nStartAddress, &nStopAddress)) - { - MessageBox(hDlg,"Wrong syntax. Use: \"startadress - stopaddress\" (000 - 3ff)","UserPort",MB_OK); - return FALSE; - } - - wsprintf(szTemp2,"%X - %X",nStartAddress,nStopAddress); - SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)szTemp2); - SetDlgItemText(hDlg,IDC_AUMP_EDIT_ADD,""); - return TRUE; -} - -BOOL AddTCFBtn() -{ - char szTemp[256]; - char szTemp2[256]; - unsigned nStartAddress,nStopAddress; - - GetDlgItemText(hDlg,IDC_TCF_EDIT_ADD,szTemp,sizeof(szTemp)); - - if (!GetStartAndStopAddress(szTemp, &nStartAddress, &nStopAddress)) - { - MessageBox(hDlg,"Wrong syntax. Use: \"startadress - stopaddress\" (000 - 3ff)","UserPort",MB_OK); - return FALSE; - } - - wsprintf(szTemp2,"%X - %X",nStartAddress,nStopAddress); - SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)szTemp2); - SetDlgItemText(hDlg,IDC_TCF_EDIT_ADD,""); - return TRUE; -} - -BOOL UpdateBtn() -{ - HKEY hKey; - DWORD wType; - UCHAR AllProcessesIOPM[0x80]; - UCHAR ThroughCreateFileIOPM[0x80]; - unsigned nCount,i,j; - char szTemp[256]; - unsigned nStartAddress,nStopAddress; - - for (i=0;i<sizeof(AllProcessesIOPM);i++) - AllProcessesIOPM[i] = 0xff; - - nCount = SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_GETCOUNT, 0,0); - - for (i=0;i<nCount;i++) - { - SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_GETTEXT, i,(LPARAM)szTemp); - if (GetStartAndStopAddress(szTemp, &nStartAddress, &nStopAddress)) - { - for (j=nStartAddress;j<=nStopAddress;j++) - AllProcessesIOPM[j>>3] &= ~(1 << (j&7)); - } - } - - for (i=0;i<sizeof(ThroughCreateFileIOPM);i++) - ThroughCreateFileIOPM[i] = 0xff; - - nCount = SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_GETCOUNT, 0,0); - - for (i=0;i<nCount;i++) - { - SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_GETTEXT, i,(LPARAM)szTemp); - if (GetStartAndStopAddress(szTemp, &nStartAddress, &nStopAddress)) - { - for (j=nStartAddress;j<=nStopAddress;j++) - ThroughCreateFileIOPM[j>>3] &= ~(1 << (j&7)); - } - } - - if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, - "Software\\UserPort",0,"", - REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS, - NULL,&hKey,&wType) == ERROR_SUCCESS) - { - RegSetValueEx(hKey, - "AllProcessesIOPM",0,REG_BINARY, - (BYTE *)AllProcessesIOPM,sizeof(AllProcessesIOPM)); - RegSetValueEx(hKey, - "ThroughCreateFileIOPM",0,REG_BINARY, - (BYTE *)ThroughCreateFileIOPM,sizeof(ThroughCreateFileIOPM)); - - RegCloseKey(hKey); - if (StopDriver()) - { - Sleep(200); - StartDriver(); - } - return TRUE; - } - - return FALSE; -} - -BOOL ReadRegistry() -{ - UCHAR AllProcessesIOPM[0x80]; - UCHAR ThroughCreateFileIOPM[0x80]; - char szTemp[256]; - unsigned i,nStartAddress,nStopAddress; - - DWORD cb,wType, bResult1 = FALSE, bResult2 = FALSE; - HKEY hKey; - - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, - "Software\\UserPort",0,KEY_READ, - &hKey) == ERROR_SUCCESS) - { - cb = sizeof(AllProcessesIOPM); - if (RegQueryValueEx(hKey,"AllProcessesIOPM",0,&wType,(BYTE *)AllProcessesIOPM,&cb) == ERROR_SUCCESS) - bResult1 = TRUE; - cb = sizeof(ThroughCreateFileIOPM); - if (RegQueryValueEx(hKey,"ThroughCreateFileIOPM",0,&wType,(BYTE *)ThroughCreateFileIOPM,&cb) == ERROR_SUCCESS) - bResult2 = TRUE; - RegCloseKey(hKey); - } - - if ((bResult1 == FALSE) || (bResult2 == FALSE)) - return FALSE; - - for (i=0;i <sizeof(AllProcessesIOPM)<<3;i++) - { - if ((AllProcessesIOPM[i>>3] & (1 << (i&7))) == 0) - { - nStartAddress = i; - do - { - nStopAddress = i; - i++; - } while ((i < sizeof(AllProcessesIOPM)<<3) && ((AllProcessesIOPM[i>>3] & (1 << (i&7))) == 0)); - wsprintf(szTemp,"%X - %X",nStartAddress,nStopAddress); - SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)szTemp); - } - } - - for (i=0;i <sizeof(ThroughCreateFileIOPM)<<3;i++) - { - if ((ThroughCreateFileIOPM[i>>3] & (1 << (i&7))) == 0) - { - nStartAddress = i; - do - { - nStopAddress = i; - i++; - } while ((i < sizeof(ThroughCreateFileIOPM)<<3) && ((ThroughCreateFileIOPM[i>>3] & (1 << (i&7))) == 0)); - wsprintf(szTemp,"%X - %X",nStartAddress,nStopAddress); - SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)szTemp); - } - } - - return TRUE; -} - -BOOL AddAUMPDefaults() -{ - int nCount,i; - - nCount = SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_GETCOUNT, 0,0); - - for (i=0;i<nCount;i++) - SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_DELETESTRING, 0,0); - - SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)"200 - 37F"); - SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)"3BC - 3BF"); - SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)"3E8 - 3FF"); - return TRUE; -} -BOOL AddTCFDefaults() -{ - int nCount,i; - - nCount = SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_GETCOUNT, 0,0); - - for (i=0;i<nCount;i++) - SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_DELETESTRING, 0,0); - - SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)"200 - 37F"); - SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)"3BC - 3BF"); - SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_ADDSTRING, 0,(LPARAM)"3E8 - 3FF"); - return TRUE; -} - -BOOL WINAPI DlgProc( - HWND hWnd, //Handtag till fЎnster, 16-bitar - UINT msg, //Meddelande, unsigned int - WPARAM wParam, //Parameter (word), unsigned int - LPARAM lParam ) //Parameter (long), unsigned long int -{ - char szTemp[256]; - int nIndex; - switch (msg) - { - case WM_INITDIALOG: - hDlg=hWnd; - if (!ReadRegistry()) - { - AddTCFDefaults(); - AddAUMPDefaults(); - } - break; - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case IDCANCEL: - PostQuitMessage ( 0 ); - EndDialog(hWnd,FALSE); - break; - case IDC_BUTTON_START: - StartDriver(); - break; - case IDC_BUTTON_STOP: - if (!StopDriver()) - { - if (GetLastError() == ERROR_ACCESS_DENIED) - MessageBox(hDlg,"You are not authorized to remove drivers.\r\nPlase contact your administrator.","UserPort",MB_OK); - else - MessageBox(hDlg,"Driver is not installed!","UserPort",MB_OK); - } - break; - case IDC_AUMP_BUTTON_ADD: - AddAUMPBtn(); - break; - case IDC_TCF_BUTTON_ADD: - AddTCFBtn(); - break; - case IDC_BUTTON_UPDATE: - UpdateBtn(); - break; - case IDC_AUMP_BUTTON_REMOVE: - nIndex = SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_GETCURSEL, 0,0); - SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_DELETESTRING, nIndex,0); - EnableWindow(GetDlgItem(hWnd,IDC_AUMP_BUTTON_REMOVE), FALSE); - break; - case IDC_TCF_BUTTON_REMOVE: - nIndex = SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_GETCURSEL, 0,0); - SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_DELETESTRING, nIndex,0); - EnableWindow(GetDlgItem(hWnd,IDC_TCF_BUTTON_REMOVE), FALSE); - break; - case IDC_AUMP_BUTTON_DEFAULTS: - AddAUMPDefaults(); - break; - case IDC_TCF_BUTTON_DEFAULTS: - AddTCFDefaults(); - break; - case IDC_AUMP_EDIT_ADD: - GetDlgItemText(hDlg,IDC_AUMP_EDIT_ADD,szTemp,sizeof(szTemp)); - EnableWindow(GetDlgItem(hWnd,IDC_AUMP_BUTTON_ADD), szTemp[0]!='\0'); - break; - case IDC_TCF_EDIT_ADD: - GetDlgItemText(hDlg,IDC_TCF_EDIT_ADD,szTemp,sizeof(szTemp)); - EnableWindow(GetDlgItem(hWnd,IDC_TCF_BUTTON_ADD), szTemp[0]!='\0'); - break; - case IDC_AUMP_LIST_GRANTS: - if (HIWORD(wParam) == LBN_SELCHANGE) - { - nIndex = SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_GETCURSEL, 0,0); - SendDlgItemMessage(hDlg, IDC_AUMP_LIST_GRANTS,LB_SETCURSEL, nIndex,0); - EnableWindow(GetDlgItem(hWnd,IDC_AUMP_BUTTON_REMOVE), TRUE); - } - break; - case IDC_TCF_LIST_GRANTS: - if (HIWORD(wParam) == LBN_SELCHANGE) - { - nIndex = SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_GETCURSEL, 0,0); - SendDlgItemMessage(hDlg, IDC_TCF_LIST_GRANTS,LB_SETCURSEL, nIndex,0); - EnableWindow(GetDlgItem(hWnd,IDC_TCF_BUTTON_REMOVE), TRUE); - } - break; - default: - return FALSE; - break; - } - break; - default: - return FALSE; - } - return TRUE; -} //DlgProc - -int WINAPI WinMain( - HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpszCmdline, - int nShow ) -{ - MSG msg; - - OSVERSIONINFO osvi; - - GetVersionEx(&osvi); - - if ((osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) || (osvi.dwPlatformId == VER_PLATFORM_WIN32s)) - { - MessageBox(NULL,"UserPort does not work on Windows 3.11/95/98/Me.\r\n\r\nUsermode programs does always have access to ports in Windows 3.11/95/98.\r\nThis program is therefore not needed on these operating systems.","UserPort",MB_OK); - return 0; - } - - if (lpszCmdline[0] != '\0') - lstrcpy(szDriverFileName, lpszCmdline); - else - lstrcpy(szDriverFileName,"\\SystemRoot\\System32\\Drivers\\UserPort.sys"); - CreateDialog( - hInstance, - MAKEINTRESOURCE(IDD_USERPORT), - NULL, - (DLGPROC)DlgProc); - - SetClassLong(hDlg,GCL_HICON,(long)LoadIcon ( hInstance, MAKEINTRESOURCE(IDI_APP))); - - while ( GetMessage ( &msg, NULL, 0, 0 ) ) - { - if (IsDialogMessage(hDlg,&msg)) - continue; - TranslateMessage ( &msg ); - DispatchMessage ( &msg ); - } - return 0; -} //WinMain diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.ico b/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.ico Binary files differdeleted file mode 100644 index a603441..0000000 --- a/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.ico +++ /dev/null diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.mak b/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.mak deleted file mode 100644 index 0b5d146..0000000 --- a/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.mak +++ /dev/null @@ -1,240 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Format Version 4.10 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -!IF "$(CFG)" == "" -CFG=UserPort - Win32 Debug -!MESSAGE No configuration specified. Defaulting to UserPort - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "UserPort - Win32 Release" && "$(CFG)" !=\ - "UserPort - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE on this makefile -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "UserPort.mak" CFG="UserPort - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "UserPort - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "UserPort - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF -################################################################################ -# Begin Project -# PROP Target_Last_Scanned "UserPort - Win32 Debug" -CPP=cl.exe -MTL=mktyplib.exe -RSC=rc.exe - -!IF "$(CFG)" == "UserPort - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -OUTDIR=.\Release -INTDIR=.\Release - -ALL : "$(OUTDIR)\UserPort.exe" - -CLEAN : - -@erase "$(INTDIR)\UserPort.obj" - -@erase "$(INTDIR)\UserPort.res" - -@erase "$(OUTDIR)\UserPort.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -CPP_PROJ=/nologo /ML /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\ - /Fp"$(INTDIR)/UserPort.pch" /YX /Fo"$(INTDIR)/" /c -CPP_OBJS=.\Release/ -CPP_SBRS=.\. -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /win32 -MTL_PROJ=/nologo /D "NDEBUG" /win32 -# ADD BASE RSC /l 0x41d /d "NDEBUG" -# ADD RSC /l 0x41d /d "NDEBUG" -RSC_PROJ=/l 0x41d /fo"$(INTDIR)/UserPort.res" /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/UserPort.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib msvcrt.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib -LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib msvcrt.lib /nologo /subsystem:windows /incremental:no\ - /pdb:"$(OUTDIR)/UserPort.pdb" /machine:I386 /nodefaultlib\ - /out:"$(OUTDIR)/UserPort.exe" -LINK32_OBJS= \ - "$(INTDIR)\UserPort.obj" \ - "$(INTDIR)\UserPort.res" - -"$(OUTDIR)\UserPort.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "UserPort - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -OUTDIR=.\Debug -INTDIR=.\Debug - -ALL : "$(OUTDIR)\UserPort.exe" "$(OUTDIR)\UserPort.bsc" - -CLEAN : - -@erase "$(INTDIR)\UserPort.obj" - -@erase "$(INTDIR)\UserPort.res" - -@erase "$(INTDIR)\UserPort.sbr" - -@erase "$(INTDIR)\vc40.idb" - -@erase "$(INTDIR)\vc40.pdb" - -@erase "$(OUTDIR)\UserPort.bsc" - -@erase "$(OUTDIR)\UserPort.exe" - -@erase "$(OUTDIR)\UserPort.ilk" - -@erase "$(OUTDIR)\UserPort.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /c -CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\ - /FR"$(INTDIR)/" /Fp"$(INTDIR)/UserPort.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/"\ - /c -CPP_OBJS=.\Debug/ -CPP_SBRS=.\Debug/ -# ADD BASE MTL /nologo /D "_DEBUG" /win32 -# ADD MTL /nologo /D "_DEBUG" /win32 -MTL_PROJ=/nologo /D "_DEBUG" /win32 -# ADD BASE RSC /l 0x41d /d "_DEBUG" -# ADD RSC /l 0x41d /d "_DEBUG" -RSC_PROJ=/l 0x41d /fo"$(INTDIR)/UserPort.res" /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/UserPort.bsc" -BSC32_SBRS= \ - "$(INTDIR)\UserPort.sbr" - -"$(OUTDIR)\UserPort.bsc" : "$(OUTDIR)" $(BSC32_SBRS) - $(BSC32) @<< - $(BSC32_FLAGS) $(BSC32_SBRS) -<< - -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 -# ADD LINK32 ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /debug /machine:I386 -# SUBTRACT LINK32 /nodefaultlib -LINK32_FLAGS=ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib\ - winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows\ - /incremental:yes /pdb:"$(OUTDIR)/UserPort.pdb" /debug /machine:I386\ - /out:"$(OUTDIR)/UserPort.exe" -LINK32_OBJS= \ - "$(INTDIR)\UserPort.obj" \ - "$(INTDIR)\UserPort.res" - -"$(OUTDIR)\UserPort.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - -.c{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.c{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -################################################################################ -# Begin Target - -# Name "UserPort - Win32 Release" -# Name "UserPort - Win32 Debug" - -!IF "$(CFG)" == "UserPort - Win32 Release" - -!ELSEIF "$(CFG)" == "UserPort - Win32 Debug" - -!ENDIF - -################################################################################ -# Begin Source File - -SOURCE=.\UserPort.rc -DEP_RSC_USERP=\ - ".\UserPort.ico"\ - - -"$(INTDIR)\UserPort.res" : $(SOURCE) $(DEP_RSC_USERP) "$(INTDIR)" - $(RSC) $(RSC_PROJ) $(SOURCE) - - -# End Source File -################################################################################ -# Begin Source File - -SOURCE=.\UserPort.c - -!IF "$(CFG)" == "UserPort - Win32 Release" - - -"$(INTDIR)\UserPort.obj" : $(SOURCE) "$(INTDIR)" - - -!ELSEIF "$(CFG)" == "UserPort - Win32 Debug" - - -"$(INTDIR)\UserPort.obj" : $(SOURCE) "$(INTDIR)" - -"$(INTDIR)\UserPort.sbr" : $(SOURCE) "$(INTDIR)" - - -!ENDIF - -# End Source File -# End Target -# End Project -################################################################################ diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.mdp b/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.mdp Binary files differdeleted file mode 100644 index d332bda..0000000 --- a/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.mdp +++ /dev/null diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.rc b/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.rc deleted file mode 100644 index ad92f0d..0000000 --- a/res/ATFBlast_ALL/userport/UserPort/UserPort_EXE/UserPort.rc +++ /dev/null @@ -1,130 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Swedish resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_SVE) -#ifdef _WIN32 -LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_USERPORT DIALOG DISCARDABLE 0, 0, 243, 159 -STYLE DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | - WS_CAPTION | WS_SYSMENU -CAPTION "UserPort 1.0 - Tomas Franzon (c) 2001" -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "All User Mode Processes Grant List",IDC_STATIC,2,3,118, - 122 - LTEXT "Enter Grant Intervall:(0x000-0x3ff)",IDC_STATIC,10,13, - 105,8 - EDITTEXT IDC_AUMP_EDIT_ADD,8,23,60,14,ES_AUTOHSCROLL - LISTBOX IDC_AUMP_LIST_GRANTS,8,38,60,82,LBS_NOINTEGRALHEIGHT | - WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Add",IDC_AUMP_BUTTON_ADD,74,24,38,14,WS_DISABLED - PUSHBUTTON "Remove",IDC_AUMP_BUTTON_REMOVE,74,41,38,14,WS_DISABLED - GROUPBOX "Driver (UserPort.SYS)",IDC_STATIC,2,124,139,33 - PUSHBUTTON "Start",IDC_BUTTON_START,7,136,36,14 - PUSHBUTTON "Update",IDC_BUTTON_UPDATE,53,136,35,14 - PUSHBUTTON "Stop",IDC_BUTTON_STOP,98,136,36,14 - PUSHBUTTON "Exit",IDCANCEL,145,128,95,29 - PUSHBUTTON "Defaults",IDC_AUMP_BUTTON_DEFAULTS,74,59,38,14 - GROUPBOX "Through ""\\\\.\\UserPort"" Grant List",IDC_STATIC,123, - 3,118,122 - LTEXT "Enter Grant Intervall:(0x000-0x3ff)",IDC_STATIC,131,13, - 108,8 - EDITTEXT IDC_TCF_EDIT_ADD,129,22,60,14,ES_AUTOHSCROLL - LISTBOX IDC_TCF_LIST_GRANTS,129,38,60,82,LBS_NOINTEGRALHEIGHT | - WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Add",IDC_TCF_BUTTON_ADD,195,24,38,14,WS_DISABLED - PUSHBUTTON "Remove",IDC_TCF_BUTTON_REMOVE,195,41,38,14,WS_DISABLED - PUSHBUTTON "Defaults",IDC_TCF_BUTTON_DEFAULTS,195,59,38,14 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_USERPORT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 241 - TOPMARGIN, 7 - BOTTOMMARGIN, 156 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_APP ICON DISCARDABLE "UserPort.ico" -#endif // Swedish resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort_SYS/Makefile b/res/ATFBlast_ALL/userport/UserPort/UserPort_SYS/Makefile deleted file mode 100644 index 5818975..0000000 --- a/res/ATFBlast_ALL/userport/UserPort/UserPort_SYS/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source -# file to this component. This file merely indirects to the real make file -# that is shared by all the driver components of the Windows NT DDK -# - -!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort_SYS/Sources b/res/ATFBlast_ALL/userport/UserPort/UserPort_SYS/Sources deleted file mode 100644 index 50c69e7..0000000 --- a/res/ATFBlast_ALL/userport/UserPort/UserPort_SYS/Sources +++ /dev/null @@ -1,7 +0,0 @@ -TARGETNAME=UserPort -TARGETPATH=. -TARGETTYPE=DRIVER - -INCLUDES=c:\ddk\inc - -SOURCES=UserPort.C diff --git a/res/ATFBlast_ALL/userport/UserPort/UserPort_SYS/UserPort.C b/res/ATFBlast_ALL/userport/UserPort/UserPort_SYS/UserPort.C deleted file mode 100644 index f0e40df..0000000 --- a/res/ATFBlast_ALL/userport/UserPort/UserPort_SYS/UserPort.C +++ /dev/null @@ -1,312 +0,0 @@ -/********************************************************************* - -Author: Tomas Franzon -Date: 11/09/2000 -Program: UserPort.SYS -Compile: Use DDK BUILD facility - -Purpose: Give direct port I/O access to user mode programs. - -This driver is influenced by an article written by Dale Roberts 8/30/95, -published in May 96 Dr Dobbs Journal, see www.ddj.com. -The driver gives user mode program access to selected ports by changing -the x86-processors IOPM (I/O Permission Map). The driver has one separate -map for all procsesses (AllProcessesIOPM) and one separate map -(ThroughCreateFileIOPM) for processes that opens the file "\\.\UserPort" - -The driver tries to read the registry keys: -HKEY_LOCAL_MACHINE\Software\UserPort\AllProcessesIOPM -HKEY_LOCAL_MACHINE\Software\UserPort\ThroughCreateFileIOPM -It will use the default values below if these doesn't exist. - -*********************************************************************/ -#include <ntddk.h> - -/* - * Make sure our structure is packed properly, on byte boundary, not - * on the default doubleword boundary. -*/ -#pragma pack(push,1) - -/* - * Structures for manipulating the GDT register and a GDT segment - * descriptor entry. Documented in Intel processor handbooks. - */ -typedef struct { - unsigned limit : 16; - unsigned baselo : 16; - unsigned basemid : 8; - unsigned type : 4; - unsigned system : 1; - unsigned dpl : 2; - unsigned present : 1; - unsigned limithi : 4; - unsigned available : 1; - unsigned zero : 1; - unsigned size : 1; - unsigned granularity : 1; - unsigned basehi : 8; -} GDTENT; - -typedef struct { - unsigned short limit; - GDTENT *base; -} GDTREG; - -#pragma pack(pop) -/* - * The name of our device driver. - */ -#define DEVICE_NAME_STRING L"UserPort" - -/* - OriginalMapCopy is used to restore the IOPM when the driver exists. - CurrentMap points to NULL or to the place where the processors IOPM is located. - Accessmap is the IOPM that is used by the driver. - Every port address has one cooresponding bit in the IOPM. The driver supports - addresses from 0x000 to 0x3FF and the IOPM size is then 0x3ff / 8 = 0x80. - */ - -UCHAR OriginalAllProcIOPMCopy[0x80]; -UCHAR OriginalThroughCreateFileIOPMCopy[0x80]; -const UCHAR DefaultMap[0x80]= -/*0x000*/ {0xFF,0xFF, -/*0x010*/ 0xFF,0xFF, -/*0x020*/ 0xFF,0xFF, -/*0x030*/ 0xFF,0xFF, -/*0x040*/ 0xFF,0xFF, -/*0x050*/ 0xFF,0xFF, -/*0x060*/ 0xFF,0xFF, -/*0x070*/ 0xFF,0xFF, -/*0x080*/ 0xFF,0xFF, -/*0x090*/ 0xFF,0xFF, -/*0x0A0*/ 0xFF,0xFF, -/*0x0B0*/ 0xFF,0xFF, -/*0x0C0*/ 0xFF,0xFF, -/*0x0D0*/ 0xFF,0xFF, -/*0x0E0*/ 0xFF,0xFF, -/*0x0F0*/ 0xFF,0xFF, -/*0x100*/ 0xFF,0xFF, -/*0x110*/ 0xFF,0xFF, -/*0x120*/ 0xFF,0xFF, -/*0x130*/ 0xFF,0xFF, -/*0x140*/ 0xFF,0xFF, -/*0x150*/ 0xFF,0xFF, -/*0x160*/ 0xFF,0xFF, -/*0x170*/ 0xFF,0xFF, -/*0x180*/ 0xFF,0xFF, -/*0x190*/ 0xFF,0xFF, -/*0x1A0*/ 0xFF,0xFF, -/*0x1B0*/ 0xFF,0xFF, -/*0x1C0*/ 0xFF,0xFF, -/*0x1D0*/ 0xFF,0xFF, -/*0x1E0*/ 0xFF,0xFF, -/*0x1F0*/ 0xFF,0xFF, -/*0x200*/ 0x00,0x00, -/*0x210*/ 0x00,0x00, -/*0x220*/ 0x00,0x00, -/*0x230*/ 0x00,0x00, -/*0x240*/ 0x00,0x00, -/*0x250*/ 0x00,0x00, -/*0x260*/ 0x00,0x00, -/*0x270*/ 0x00,0x00, -/*0x280*/ 0x00,0x00, -/*0x290*/ 0x00,0x00, -/*0x2A0*/ 0x00,0x00, -/*0x2B0*/ 0x00,0x00, -/*0x2C0*/ 0x00,0x00, -/*0x2D0*/ 0x00,0x00, -/*0x2E0*/ 0x00,0x00, -/*0x2F0*/ 0x00,0x00, -/*0x300*/ 0x00,0x00, -/*0x310*/ 0x00,0x00, -/*0x320*/ 0x00,0x00, -/*0x330*/ 0x00,0x00, -/*0x340*/ 0x00,0x00, -/*0x350*/ 0x00,0x00, -/*0x360*/ 0x00,0x00, -/*0x370*/ 0x00,0x00, -/*0x380*/ 0xFF,0xFF, -/*0x390*/ 0xFF,0xFF, -/*0x3A0*/ 0xFF,0xFF, -/*0x3B0*/ 0xFF,0x0F, -/*0x3C0*/ 0xFF,0xFF, -/*0x3D0*/ 0xFF,0xFF, -/*0x3E0*/ 0xFF,0x00, -/*0x3F0*/ 0x00,0x00}; - -unsigned OrgGDTSize; // The original sise of the TSS - -/* - Ke386IoSetAccessProcess() adjusts the IOPM offset pointer to the IOPM at 0x88 - Ke386IoSetAccessProcess() is located in NTOSKRNL.EXE but is not included in any - header file or documented anywhere... -*/ - -void Ke386IoSetAccessProcess(PEPROCESS, int); - -/********************************************************************* - Service handler for a CreateFile() user mode call. - - This routine is entered in the driver object function call table by -the DriverEntry() routine. When the user mode application calls -CreateFile(), this routine gets called while still in the context of -the user mode application, but with the CPL (the processor's Current -Privelege Level) set to 0. This allows us to do kernel mode -operations. UserPort() is called to give the calling process I/O -access. All the user mode application needs do to obtain I/O access -is open this device with CreateFile(). No other operations are -required. -*********************************************************************/ -NTSTATUS CreateFileDispatch( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ) -{ - // Give the current process IO access - Ke386IoSetAccessProcess(PsGetCurrentProcess(), 1); - - Irp->IoStatus.Information = 0; - Irp->IoStatus.Status = STATUS_SUCCESS; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_SUCCESS; -} - -// remove the link \\.\UserPort and restore the IOPM -void UserPortUnload(IN PDRIVER_OBJECT DriverObject) -{ - WCHAR DOSNameBuffer[] = L"\\DosDevices\\" DEVICE_NAME_STRING; - UNICODE_STRING uniDOSString; - GDTREG gdtreg; - GDTENT *g; - short TaskSeg; - UCHAR *TSSAllProcessesIOPM; - UCHAR *TSSThroughCreateFileIOPM; - unsigned i; - UCHAR *TSSbase; - - _asm cli; - _asm sgdt gdtreg; - _asm str TaskSeg; - g = gdtreg.base + (TaskSeg >> 3); - g->limit = OrgGDTSize; - g->type = 9; - _asm ltr TaskSeg; - _asm sti; - - TSSbase = (UCHAR *) (g->baselo | (g->basemid << 16) | (g->basehi << 24)); - TSSAllProcessesIOPM = *((USHORT *)(TSSbase + 0x66)) + TSSbase; - TSSThroughCreateFileIOPM = TSSbase + 0x88; - - // Restore to the original map - for (i=0;i<sizeof(DefaultMap);i++) - { - TSSAllProcessesIOPM[i] = OriginalAllProcIOPMCopy[i]; - TSSThroughCreateFileIOPM[i] = OriginalThroughCreateFileIOPMCopy[i]; - } - - RtlInitUnicodeString(&uniDOSString, DOSNameBuffer); - IoDeleteSymbolicLink (&uniDOSString); - IoDeleteDevice(DriverObject->DeviceObject); -} - -// This routine is the entrypoint of the driver. -// This routine reads the AllProcessesIOPM and ThroughCreateFileIOPM from registry and start the driver -NTSTATUS DriverEntry( - IN PDRIVER_OBJECT DriverObject, - IN PUNICODE_STRING RegistryPath - ) -{ - PDEVICE_OBJECT deviceObject; - NTSTATUS status; - WCHAR NameBuffer[] = L"\\Device\\" DEVICE_NAME_STRING; - WCHAR DOSNameBuffer[] = L"\\DosDevices\\" DEVICE_NAME_STRING; - UNICODE_STRING uniNameString, uniDOSString; - GDTREG gdtreg; - GDTENT *g; - short TaskSeg; - UCHAR *TSSAllProcessesIOPM; - UCHAR *TSSThroughCreateFileIOPM; - const UCHAR *AllProcessesIOPM = DefaultMap; - const UCHAR *ThroughCreateFileIOPM = DefaultMap; - unsigned i; - UCHAR *TSSbase; - UCHAR InformationBuffer1[sizeof(DefaultMap)+sizeof(KEY_VALUE_PARTIAL_INFORMATION)]; - PKEY_VALUE_PARTIAL_INFORMATION Information1 = (PKEY_VALUE_PARTIAL_INFORMATION)InformationBuffer1; - UCHAR InformationBuffer2[sizeof(DefaultMap)+sizeof(KEY_VALUE_PARTIAL_INFORMATION)]; - PKEY_VALUE_PARTIAL_INFORMATION Information2 = (PKEY_VALUE_PARTIAL_INFORMATION)InformationBuffer2; - ULONG ResultLength; - HANDLE KeyHandle; - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING ThroughCreateFileIOPMString,AllProcessesIOPMString,RegPathString; - - RtlInitUnicodeString(&AllProcessesIOPMString, L"AllProcessesIOPM"); - RtlInitUnicodeString(&ThroughCreateFileIOPMString, L"ThroughCreateFileIOPM"); - RtlInitUnicodeString(&RegPathString,L"\\Registry\\Machine\\Software\\UserPort"); - - InitializeObjectAttributes(&ObjectAttributes,&RegPathString,OBJ_CASE_INSENSITIVE,NULL,NULL); - - if (STATUS_SUCCESS == ZwOpenKey(&KeyHandle, KEY_QUERY_VALUE,&ObjectAttributes)) - { - if (STATUS_SUCCESS == ZwQueryValueKey(KeyHandle,&ThroughCreateFileIOPMString,KeyValuePartialInformation,Information1,sizeof(InformationBuffer1),&ResultLength)) - ThroughCreateFileIOPM = Information1->Data; - if (STATUS_SUCCESS == ZwQueryValueKey(KeyHandle,&AllProcessesIOPMString,KeyValuePartialInformation,Information2,sizeof(InformationBuffer2),&ResultLength)) - AllProcessesIOPM = Information2->Data; - ZwClose(KeyHandle); - } - - _asm cli; // don't get interrupted! - _asm str TaskSeg; // get the TSS selector - _asm sgdt gdtreg; // get the GDT address - g = gdtreg.base + (TaskSeg >> 3); // get the TSS descript - // get the TSS address - OrgGDTSize = g->limit; - g->limit += 0x082; // modify TSS segment limit - g->type = 9; // mark TSS as "not busy" - _asm ltr TaskSeg; // reload task register (TR) - _asm sti; // let interrupts continue*/ - - TSSbase = (UCHAR *) (g->baselo | (g->basemid << 16) | (g->basehi << 24)); - TSSAllProcessesIOPM = *((USHORT *)(TSSbase + 0x66)) + TSSbase; - TSSThroughCreateFileIOPM = TSSbase + 0x88; - - // Copy the AccessMap to TSSbase + 0x20ad and save the original map - for (i=0;i<sizeof(DefaultMap);i++) - { - OriginalAllProcIOPMCopy[i] = TSSAllProcessesIOPM[i]; - TSSAllProcessesIOPM[i] = AllProcessesIOPM[i]; - OriginalThroughCreateFileIOPMCopy[i] = TSSThroughCreateFileIOPM[i]; - TSSThroughCreateFileIOPM[i] = TSSThroughCreateFileIOPM[i] & ThroughCreateFileIOPM[i]; - } - - // - // Set up device driver name and device object. - // Make the driver accessable though the file \\.\UserPort - - RtlInitUnicodeString(&uniNameString, NameBuffer); - RtlInitUnicodeString(&uniDOSString, DOSNameBuffer); - - status = IoCreateDevice(DriverObject, 0, - &uniNameString, - FILE_DEVICE_UNKNOWN, - 0, FALSE, &deviceObject); - - if(!NT_SUCCESS(status)) - return status; - - status = IoCreateSymbolicLink (&uniDOSString, &uniNameString); - - if (!NT_SUCCESS(status)) - return status; - - // - // Initialize the Driver Object with driver's entry points. - // All we require are the Create and Unload operations. - // - DriverObject->MajorFunction[IRP_MJ_CREATE] = CreateFileDispatch; - - DriverObject->DriverUnload = UserPortUnload; - - return STATUS_SUCCESS; -} - diff --git a/res/ATFBlast_ALL/userport/Win_XP.txt b/res/ATFBlast_ALL/userport/Win_XP.txt deleted file mode 100644 index f12ee47..0000000 --- a/res/ATFBlast_ALL/userport/Win_XP.txt +++ /dev/null @@ -1,25 +0,0 @@ -Программатор может работать в Windows 95/98/ME, но не работает в -Windows NT/2000/XP, если не установлен драйвер прямого доступа к -портам компьютера UserPort. - - Краткая инструкция. - -Если у Вас Windows NT/2000/XP, то необходимо установить дополнительную -утилиту UserPort, которая позволит программам беспрепятственно -обращаться к указанным Вами портам, в данном случае это LPT. - -Установка UserPort: -1. Распаковываем UserPort.zip во временную папку. -2. Копируем файл UserPort.sys в папку C:\WINDOWS\SYSTEM32\DRIVERS -3. Запускаем файл UserPort.exe, удаляем оттуда все элементы. -4. Заходим в Панель Управления\Система, выбираем закладку Оборудование, - Диспетчер устройств, заходим в Порты (COM и LPT) и смотрим - свойства LPT порта, по которому вы хотите установить соединение. - В Свойствах открываем закладку Ресурсы и смотрим значение - параметра Диапазон ввода/вывода (I/O). (Например, у меня в - Windows XP оно равно 378 - 37F) -5. Добавляем это значение в UserPort.exe (в оба поля) и нажимаем - кнопку Start. - -После этого должен появиться доступ к портам и можно запускать -программу ATFBLAST.EXE.
\ No newline at end of file |