test: imminit.c File Reference

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# imminit.c File Reference

`#include "precomp.h"`

Go to the source code of this file.

## Functions

BOOL | ImmInitializeGlobals (HINSTANCE hmod)
BOOL | ImmRegisterClient (IN PSHAREDINFO psiClient, HINSTANCE hmod)
BOOL | ImmDllInitialize (IN PVOID hmod, IN DWORD Reason, IN PCONTEXT pctx OPTIONAL)
PVOID | UserRtlAllocMem (ULONG uBytes)
VOID | UserRtlFreeMem (PVOID pMem)
VOID | UserRtlRaiseStatus (NTSTATUS Status)
DWORD | GetRipComponent (VOID)
DWORD | GetDbgTagFlags (int tag)
DWORD | GetRipPID (VOID)
DWORD | GetRipFlags (VOID)
VOID | NtUserSetRipFlags (DWORD, DWORD)
VOID | SetRipFlags (DWORD dwRipFlags, DWORD dwRipPID)
VOID | SetDbgTag (int tag, DWORD dwBitFlags)

## Variables

ULONG_PTR | gHighestUserAddress

## Function Documentation

DWORD GetDbgTagFlags | ( | int | tag | ) |

Definition at line 138 of file imminit.c.

References DWORD, gpsi, and NULL.

    00139 {
    00140 #if DEBUGTAGS
    00141     return (gpsi != NULL ? gpsi->adwDBGTAGFlags[tag] : 0);
    00142 #else
    00143     return 0;
    00144     UNREFERENCED_PARAMETER(tag);
    00145 #endif // DEBUGTAGS
    00146 }

DWORD GetRipComponent | ( | VOID |  | ) |

Definition at line 136 of file imminit.c.

References DWORD.

    00136 { return RIP_IMM; }

DWORD GetRipFlags | ( | VOID |  | ) |

Definition at line 149 of file imminit.c.

References DWORD, gpsi, NULL, RIPF_DEFAULT, and tagSERVERINFO::wRIPFlags.

    00149 { return (gpsi != NULL ? gpsi->wRIPFlags : RIPF_DEFAULT); }

DWORD GetRipPID | ( | VOID |  | ) |

Definition at line 148 of file imminit.c.

References DWORD, gpsi, NULL, and tagSERVERINFO::wRIPPID.

    00148 { return (gpsi != NULL ? gpsi->wRIPPID : 0); }

BOOL ImmDllInitialize | ( | IN PVOID | hmod,
|  | IN DWORD | Reason,
|  | IN PCONTEXT pctx | OPTIONAL
| ) |

Definition at line 67 of file imminit.c.

References BOOL, DestroyInputContext(), FALSE, gcsImeDpi, GetKeyboardLayout(), gfInitialized, ghInst, IMM_MAGIC_CALLER_ID, ImmInitializeGlobals(), IS_IME_ENABLED, NtUserGetThreadState(), NULL, RtlDeleteCriticalSection(), TRUE, and User32InitializeImmEntryTable().

    00071 {
    00072     UNREFERENCED_PARAMETER(pctx);
    00073
    00074     switch ( Reason ) {
    00075
    00076     case DLL_PROCESS_ATTACH:
    00077         UserAssert(!gfInitialized || hmod == ghInst);
    00078
    00079         if (!ImmInitializeGlobals(hmod))
    00080             return FALSE;
    00081
    00082         UserAssert(hmod != NULL);
    00083
    00084         // Initialize USER32.DLL in case if USER32 has not bound itself to IMM32
    00085         if (!User32InitializeImmEntryTable(IMM_MAGIC_CALLER_ID))
    00086             return FALSE;
    00087         break;
    00088
    00089     case DLL_PROCESS_DETACH:
    00090         if (gfInitialized) {
    00091             RtlDeleteCriticalSection(&gcsImeDpi);
    00092         }
    00093         break;
    00094
    00095     case DLL_THREAD_DETACH:
    00096         if (IS_IME_ENABLED()) {
    00097             DestroyInputContext(
    00098                 (HIMC)NtUserGetThreadState(UserThreadStateDefaultInputContext),
    00099                 GetKeyboardLayout(0),
    00100                 TRUE);
    00101         }
    00102         break;
    00103
    00104     default:
    00105         break;
    00106     }
    00107
    00108     return TRUE;
    00109 }

BOOL ImmInitializeGlobals | ( | HINSTANCE | hmod | ) |

Definition at line 19 of file imminit.c.

References BOOL, FALSE, gcsImeDpi, gfInitialized, gHighestUserAddress, ghInst, NT_SUCCESS, NtQuerySystemInformation(), NULL, RtlInitializeCriticalSection(), and TRUE.

Referenced by ImmDllInitialize(), and ImmRegisterClient().

    00020 {
    00021     SYSTEM_BASIC_INFORMATION SystemInformation;
    00022
    00023     if (hmod) {
    00024         /*
    00025          * Remember IMM32.DLL's hmodule so we can grab resources from it later.
    00026          */
    00027         ghInst = hmod;
    00028     }
    00029     if (gfInitialized) {
    00030         return TRUE;
    00031     }
    00032     if (!NT_SUCCESS(RtlInitializeCriticalSection(&gcsImeDpi))) {
    00033         RIPMSG0(RIP_WARNING, "ImmInitializeGlobals: failed to initialize critical section at startup. Just bail.");
    00034         return FALSE;
    00035     }
    00036     if (!NT_SUCCESS(NtQuerySystemInformation(SystemBasicInformation,
    00037             &SystemInformation,
    00038             sizeof(SystemInformation),
    00039             NULL))) {
    00040         RIPMSG0(RIP_WARNING, "ImmInitializeGlobals: failed to query system information. Just bail.");
    00041         return FALSE;
    00042     }
    00043     gHighestUserAddress = SystemInformation.MaximumUserModeAddress;
    00044
    00045     gfInitialized = TRUE;
    00046
    00047     return TRUE;
    00048 }

BOOL ImmRegisterClient | ( | IN PSHAREDINFO | psiClient,
|  | HINSTANCE | hmod
| ) |

Definition at line 51 of file imminit.c.

References BOOL, gpsi, gSharedInfo, ImmInitializeGlobals(), and tagSHAREDINFO::psi.

Referenced by _InitializeImmEntryTable().

    00053 {
    00054     gSharedInfo = *psiClient;
    00055     gpsi = gSharedInfo.psi;
    00056     /* Raid #97316
    00057      * Dlls loaded earlier than imm32.dll could make
    00058      * user32 call which calls back imm routines.
    00059      * ImmRegisterClient() is called from User32's init routine,
    00060      * so we can expect to reach here early enough.
    00061      * We need to initialize globals as much as possible
    00062      * here.
    00063      */
    00064     return ImmInitializeGlobals(hmod);
    00065 }

VOID NtUserSetRipFlags | ( | DWORD | ,
|  | DWORD |
| ) |

Definition at line 4490 of file kernel/ntstubs.c.

    04491 {
    04492     BEGINRECV_VOID();
    04493
    04494     _SetRipFlags(dwRipFlags, dwPID);
    04495
    04496     TRACEVOID("NtUserSetRipFlags");
    04497     ENDRECV_VOID();
    04498 }

VOID SetDbgTag | ( | int | tag,
|  | DWORD | dwBitFlags
| ) |

Definition at line 158 of file imminit.c.

References VOID().

    00159 {
    00160     RIPMSG0(RIP_ERROR, "SetDbgTag not available in imm32.dll");
    00161     return;
    00162     UNREFERENCED_PARAMETER(tag);
    00163     UNREFERENCED_PARAMETER(dwBitFlags);
    00164 }

VOID SetRipFlags | ( | DWORD | dwRipFlags,
|  | DWORD | dwRipPID
| ) |

Definition at line 153 of file imminit.c.

References NtUserSetRipFlags(), and VOID().

    00154 {
    00155     NtUserSetRipFlags(dwRipFlags, dwRipPID);
    00156 }

PVOID UserRtlAllocMem | ( | ULONG | uBytes | ) |

Definition at line 118 of file imminit.c.

    00120 {
    00121     return LocalAlloc(LPTR, uBytes);
    00122 }

VOID UserRtlFreeMem | ( | PVOID | pMem | ) |

Definition at line 124 of file imminit.c.

References VOID().

    00126 {
    00127     LocalFree(pMem);
    00128 }

VOID UserRtlRaiseStatus | ( | NTSTATUS | Status | ) |

Definition at line 130 of file imminit.c.

References RtlRaiseStatus(), Status, and VOID().

    00132 {
    00133     RtlRaiseStatus(Status);
    00134 }

## Variable Documentation

ULONG_PTR gHighestUserAddress

| Definition at line 16 of file imminit.c.