Changeset 2257
- Timestamp:
- 07/16/08 01:55:20 (6 months ago)
- Location:
- trunk/source/NVDAHelper
- Files:
-
- 3 modified
-
IA2Support.c (modified) (2 diffs)
-
IA2Support.h (modified) (1 diff)
-
hookManager.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/NVDAHelper/IA2Support.c
r2233 r2257 29 29 IUnknown* IA2DllPunk=NULL; 30 30 31 voidinstallIA2Support() {31 BOOL installIA2Support() { 32 32 LPFNGETCLASSOBJECT IA2Dll_DllGetClassObject; 33 33 int i; 34 if(isIA2Installed) return; 35 IA2DllHandle=CoLoadLibrary(IA2DllPath,TRUE); 36 if(IA2DllHandle==0) return; 37 IA2Dll_DllGetClassObject=(LPFNGETCLASSOBJECT)GetProcAddress(IA2DllHandle,"DllGetClassObject"); 38 IA2Dll_DllGetClassObject(&IAccessible2ProxyIID,&IID_IUnknown,(LPVOID*)&IA2DllPunk); 39 CoRegisterClassObject(&IAccessible2ProxyIID,IA2DllPunk,CLSCTX_LOCAL_SERVER,REGCLS_MULTIPLEUSE,(LPDWORD)&IA2RegCooky); 34 int res; 35 if(isIA2Installed) return TRUE; 36 if((IA2DllHandle=CoLoadLibrary(IA2DllPath,TRUE))==NULL) { 37 fprintf(stderr,"Error loading IAccessible2 proxy dll\n"); 38 return FALSE; 39 } 40 if((IA2Dll_DllGetClassObject=(LPFNGETCLASSOBJECT)GetProcAddress(IA2DllHandle,"DllGetClassObject"))==NULL) { 41 fprintf(stderr,"Error locating DllGetClassObject function in IAccessible2 proxy dll\n"); 42 return FALSE; 43 } 44 if((res=IA2Dll_DllGetClassObject(&IAccessible2ProxyIID,&IID_IUnknown,(LPVOID*)&IA2DllPunk))!=S_OK) { 45 fprintf(stderr,"Error calling DllGetClassObject, code %d\n",res); 46 return FALSE; 47 } 48 if((res=CoRegisterClassObject(&IAccessible2ProxyIID,IA2DllPunk,CLSCTX_LOCAL_SERVER,REGCLS_MULTIPLEUSE,(LPDWORD)&IA2RegCooky))!=S_OK) { 49 fprintf(stderr,"Error registering class object, code %d\n",res); 50 return FALSE; 51 } 40 52 for(i=0;i<ia2InterfaceCount;i++) { 41 53 CoGetPSClsid(&(ia2ClsidArray[i][0]),&(ia2ClsidArray[i][1])); 42 CoRegisterPSClsid(&(ia2ClsidArray[i][0]),&IAccessible2ProxyIID); 54 if((res=CoRegisterPSClsid(&(ia2ClsidArray[i][0]),&IAccessible2ProxyIID))!=S_OK) { 55 fprintf(stderr,"Error registering PSClsid for interface %d, code %d\n",i,res); 56 return FALSE; 57 } 43 58 } 44 59 isIA2Installed=TRUE; 60 return TRUE; 45 61 } 46 62 47 voiduninstallIA2Support() {63 BOOL uninstallIA2Support() { 48 64 int i; 65 int res; 49 66 if(IA2DllHandle!=0) { 50 67 for(i=0;i<ia2InterfaceCount;i++) { 51 CoRegisterPSClsid(&(ia2ClsidArray[i][0]),&(ia2ClsidArray[i][1])); 68 if((res=CoRegisterPSClsid(&(ia2ClsidArray[i][0]),&(ia2ClsidArray[i][1])))!=S_OK) { 69 fprintf(stderr,"Error reregistering previous PSClsid for interface %d, code %d\n",i,res); 70 return FALSE; 71 } 52 72 } 53 CoRevokeClassObject(IA2RegCooky); 73 if((res=CoRevokeClassObject(IA2RegCooky))!=S_OK) { 74 fprintf(stderr,"Error revoking class object, code %d\n",res); 75 return FALSE; 76 } 54 77 CoFreeUnusedLibrariesEx(0,0); 55 78 IA2DllHandle=0; 56 79 isIA2Installed=FALSE; 57 80 } 81 return TRUE; 58 82 } 59 83 60 voidIA2Support_initialize() {84 BOOL IA2Support_initialize() { 61 85 int count=0; 62 86 GetFullPathName(L"lib/IAccessible2Proxy.dll",256,IA2DllPath,NULL); … … 75 99 ia2ClsidArray[count++][0]=IID_IAccessibleValue; 76 100 isIA2Initialized=TRUE; 77 installIA2Support(); 101 if(!installIA2Support()) { 102 fprintf(stderr,"Error installing IA2 support\n"); 103 return FALSE; 104 } 105 return TRUE; 78 106 } 107 108 BOOL IA2Support_terminate() { 109 if(!uninstallIA2Support()) { 110 fprintf(stderr,"Error uninstalling IA2 support\n"); 111 return FALSE; 112 } 113 return TRUE; 114 } -
trunk/source/NVDAHelper/IA2Support.h
r2193 r2257 12 12 13 13 //Private functions 14 void IA2Support_initialize(); 15 void installIA2Support(); 14 BOOL IA2Support_initialize(); 15 BOOL installIA2Support(); 16 BOOL uninstallIA2Support(); 17 BOOL IA2Support_terminate(); 16 18 17 19 #endif -
trunk/source/NVDAHelper/hookManager.c
r2214 r2257 71 71 GetWindowThreadProcessId(GetDesktopWindow(),&desktopProcessID); 72 72 GetWindowThreadProcessId(GetShellWindow(),&shellProcessID); 73 IA2Support_initialize(); 73 if(!IA2Support_initialize()) { 74 fprintf(stderr,"Error initializing IA2 support\n"); 75 return -1; 76 } 74 77 if((getMessageHookID=SetWindowsHookEx(WH_GETMESSAGE,(HOOKPROC)getMessageHook,moduleHandle,0))==0) { 75 78 fprintf(stderr,"Error registering window message hook\n"); … … 105 108 return -1; 106 109 } 110 if(!IA2Support_terminate()) { 111 fprintf(stderr,"Error terminating IA2 support\n"); 112 return -1; 113 } 107 114 isManagerInitialized=FALSE; 108 115 return 0;

NVDA is supported by