ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

appcache.c
Go to the documentation of this file.
00001 /*
00002  * PROJECT:         ReactOS Win32 Base API
00003  * LICENSE:         GPL - See COPYING in the top level directory
00004  * FILE:            dll/win32/kernel32/client/appcache.c
00005  * PURPOSE:         Application Compatibility Cache
00006  * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
00007  */
00008 
00009 /* INCLUDES *******************************************************************/
00010 
00011 #include <k32.h>
00012 
00013 #define NDEBUG
00014 #include <debug.h>
00015 
00016 /* GLOBALS ********************************************************************/
00017 
00018 ULONG g_ShimsEnabled;
00019  
00020 /* FUNCTIONS ******************************************************************/
00021 
00022 BOOLEAN
00023 WINAPI
00024 IsShimInfrastructureDisabled(VOID)
00025 {
00026     HANDLE KeyHandle;
00027     NTSTATUS Status;
00028     KEY_VALUE_PARTIAL_INFORMATION KeyInfo;
00029     ULONG ResultLength;
00030     UNICODE_STRING OptionKey = RTL_CONSTANT_STRING(L"\\Registry\\MACHINE\\System\\CurrentControlSet\\Control\\SafeBoot\\Option");
00031     UNICODE_STRING AppCompatKey = RTL_CONSTANT_STRING(L"\\Registry\\MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\AppCompatibility");
00032     UNICODE_STRING PolicyKey = RTL_CONSTANT_STRING(L"\\Registry\\MACHINE\\Software\\Policies\\Microsoft\\Windows\\AppCompat");
00033     UNICODE_STRING OptionValue = RTL_CONSTANT_STRING(L"OptionValue");
00034     UNICODE_STRING DisableAppCompat = RTL_CONSTANT_STRING(L"DisableAppCompat");
00035     UNICODE_STRING DisableEngine = RTL_CONSTANT_STRING(L"DisableEngine");
00036     OBJECT_ATTRIBUTES OptionKeyAttributes = RTL_CONSTANT_OBJECT_ATTRIBUTES(&OptionKey, OBJ_CASE_INSENSITIVE);
00037     OBJECT_ATTRIBUTES AppCompatKeyAttributes = RTL_CONSTANT_OBJECT_ATTRIBUTES(&AppCompatKey, OBJ_CASE_INSENSITIVE);
00038     OBJECT_ATTRIBUTES PolicyKeyAttributes = RTL_CONSTANT_OBJECT_ATTRIBUTES(&PolicyKey, OBJ_CASE_INSENSITIVE);
00039 
00040     /*
00041      * This is a TROOLEAN, -1 means we haven't yet figured it out.
00042      * 0 means shims are enabled, and 1 means shims are disabled!
00043      */
00044     if (g_ShimsEnabled == -1)
00045     {
00046         /* Open the safe mode key */
00047         Status = NtOpenKey(&KeyHandle, 1, &OptionKeyAttributes);
00048         if (NT_SUCCESS(Status))
00049         {
00050             /* Check if this is safemode */
00051             Status = NtQueryValueKey(KeyHandle,
00052                                      &OptionValue,
00053                                      KeyValuePartialInformation,
00054                                      &KeyInfo,
00055                                      sizeof(KeyInfo),
00056                                      &ResultLength);
00057             NtClose(KeyHandle);
00058             if ((NT_SUCCESS(Status)) &&
00059                  (KeyInfo.Type == REG_DWORD) &&
00060                  (KeyInfo.DataLength == sizeof(ULONG)) &&
00061                  (KeyInfo.Data[0] == TRUE))
00062             {
00063                 /* It is, so disable shims! */
00064                 g_ShimsEnabled = TRUE;
00065             }
00066             else
00067             {
00068                 /* Open the app compatibility engine settings key */
00069                 Status = NtOpenKey(&KeyHandle, 1, &AppCompatKeyAttributes);
00070                 if (NT_SUCCESS(Status))
00071                 {
00072                     /* Check if the app compat engine is turned off */
00073                     Status = NtQueryValueKey(KeyHandle,
00074                                              &DisableAppCompat,
00075                                              KeyValuePartialInformation,
00076                                              &KeyInfo,
00077                                              sizeof(KeyInfo),
00078                                              &ResultLength);
00079                     NtClose(KeyHandle);
00080                     if ((NT_SUCCESS(Status)) &&
00081                         (KeyInfo.Type == REG_DWORD) &&
00082                         (KeyInfo.DataLength == sizeof(ULONG)) &&
00083                         (KeyInfo.Data[0] == TRUE))
00084                     {
00085                         /* It is, so disable shims! */
00086                         g_ShimsEnabled = TRUE;
00087                     }
00088                     else
00089                     {
00090                         /* Finally, open the app compatibility policy key */
00091                         Status = NtOpenKey(&KeyHandle, 1, &PolicyKeyAttributes);
00092                         if (NT_SUCCESS(Status))
00093                         {
00094                             /* Check if the system policy disables app compat */
00095                             Status = NtQueryValueKey(KeyHandle,
00096                                                      &DisableEngine,
00097                                                      KeyValuePartialInformation,
00098                                                      &KeyInfo,
00099                                                      sizeof(KeyInfo),
00100                                                      &ResultLength),
00101                                                      NtClose(KeyHandle);
00102                             if ((NT_SUCCESS(Status)) &&
00103                                 (KeyInfo.Type == REG_DWORD) &&
00104                                 (KeyInfo.DataLength == sizeof(ULONG)) &&
00105                                 (KeyInfo.Data[0] == TRUE))
00106                             {
00107                                 /* It does, so disable shims! */
00108                                 g_ShimsEnabled = TRUE;
00109                             }
00110                             else
00111                             {
00112                                 /* No keys are set, so enable shims! */
00113                                 g_ShimsEnabled = FALSE;
00114                             }
00115                         }
00116                     }
00117                 }
00118             }
00119         }
00120     }
00121 
00122     /* Return if shims are disabled or not ("Enabled == 1" means disabled!) */
00123     return g_ShimsEnabled ? TRUE : FALSE;
00124 }
00125 
00126 /*
00127  * @unimplemented
00128  */
00129 BOOL
00130 WINAPI
00131 BaseCheckAppcompatCache(IN PWCHAR ApplicationName,
00132                         IN HANDLE FileHandle,
00133                         IN PWCHAR Environment,
00134                         OUT PULONG Reason)
00135 {
00136     UNIMPLEMENTED;
00137     if (Reason) *Reason = 0;
00138     return TRUE;
00139 }
00140 
00141 /*
00142  * @implemented
00143  */
00144 NTSTATUS
00145 WINAPI
00146 BasepCheckBadapp(IN HANDLE FileHandle,
00147                  IN PWCHAR ApplicationName,
00148                  IN PWCHAR Environment,
00149                  IN USHORT ExeType,
00150                  IN PVOID* SdbQueryAppCompatData,
00151                  IN PULONG SdbQueryAppCompatDataSize,
00152                  IN PVOID* SxsData,
00153                  IN PULONG SxsDataSize,
00154                  OUT PULONG FusionFlags)
00155 {
00156     NTSTATUS Status = STATUS_SUCCESS;
00157     ULONG Reason = 0;
00158 
00159     /* Is shimming enabled by group policy? */
00160     if (IsShimInfrastructureDisabled())
00161     {
00162         /* Nothing to worry about */
00163         Status = STATUS_SUCCESS;
00164     }
00165     else
00166     {
00167         /* It is, check if we know about this app */
00168         if (!BaseCheckAppcompatCache(ApplicationName,
00169                                      FileHandle,
00170                                      Environment,
00171                                      &Reason))
00172         {
00173             /* We don't support this yet */
00174             UNIMPLEMENTED;
00175             Status = STATUS_ACCESS_DENIED;
00176         }
00177     }
00178 
00179     /* Return caller the status */
00180     return Status;
00181 }
00182 
00183 /*
00184  * @unimplemented
00185  */
00186 VOID
00187 WINAPI
00188 BaseDumpAppcompatCache(VOID)
00189 {
00190     STUB;
00191 }
00192 
00193 /*
00194  * @unimplemented
00195  */
00196 VOID
00197 WINAPI
00198 BaseFlushAppcompatCache(VOID)
00199 {
00200     STUB;
00201 }
00202 
00203 /*
00204  * @implemented
00205  */
00206 VOID
00207 WINAPI
00208 BasepFreeAppCompatData(IN PVOID AppCompatData,
00209                        IN PVOID AppCompatSxsData)
00210 {
00211     /* Free the input pointers if present */
00212     if (AppCompatData) RtlFreeHeap(RtlGetProcessHeap(), 0, AppCompatData);
00213     if (AppCompatSxsData) RtlFreeHeap(RtlGetProcessHeap(), 0, AppCompatSxsData);
00214 }
00215 
00216 /*
00217  * @unimplemented
00218  */
00219 VOID
00220 WINAPI
00221 BaseUpdateAppcompatCache(ULONG Unknown1,
00222                          ULONG Unknown2,
00223                          ULONG Unknown3)
00224 {
00225     STUB;
00226 }
00227 
00228 /*
00229  * @unimplemented
00230  */
00231 NTSTATUS
00232 WINAPI
00233 BaseCleanupAppcompatCache(VOID)
00234 {
00235     STUB;
00236     return STATUS_NOT_IMPLEMENTED;
00237 }
00238 
00239 /*
00240  * @unimplemented
00241  */
00242 NTSTATUS
00243 WINAPI
00244 BaseCleanupAppcompatCacheSupport(PVOID pUnknown)
00245 {
00246     STUB;
00247     return STATUS_NOT_IMPLEMENTED;
00248 }
00249 
00250 /*
00251  * @unimplemented
00252  */
00253 BOOL
00254 WINAPI
00255 BaseInitAppcompatCache(VOID)
00256 {
00257     STUB;
00258     return FALSE;
00259 }
00260 
00261 /*
00262  * @unimplemented
00263  */
00264 BOOL
00265 WINAPI
00266 BaseInitAppcompatCacheSupport(VOID)
00267 {
00268     STUB;
00269     return FALSE;
00270 }
00271 
00272 /*
00273  * @unimplemented
00274  */
00275 PVOID
00276 WINAPI
00277 GetComPlusPackageInstallStatus(VOID)
00278 {
00279     STUB;
00280     return NULL;
00281 }
00282 
00283 /*
00284  * @unimplemented
00285  */
00286 BOOL
00287 WINAPI
00288 SetComPlusPackageInstallStatus(LPVOID lpInfo)
00289 {
00290    STUB;
00291    return FALSE;
00292 }
00293 
00294 /*
00295  * @unimplemented
00296  */
00297 VOID
00298 WINAPI
00299 SetTermsrvAppInstallMode(IN BOOL bInstallMode)
00300 {
00301     STUB;
00302 }
00303 
00304 /*
00305  * @unimplemented
00306  */
00307 BOOL
00308 WINAPI
00309 TermsrvAppInstallMode(VOID)
00310 {
00311     STUB;
00312     return FALSE;
00313 }

Generated on Fri May 25 2012 04:22:17 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.