- if(Msg->Size < sizeof(*info)) return ;
- if(Msg->Size < sizeof(*info) + info->Length) return ;
- if(!dest || !dest->Handler) return ;
- dest->Handler(dest, info->ID, info->Length, info->Data);
+ if(Msg->Size < sizeof(*info) || Msg->Size < sizeof(*info) + info->Length) {
+ _SysDebug("Message is undersized (%i < %i + %i)",
+ Msg->Size < sizeof(*info), info->Length);
+ return ;
+ }
+ if(!dest || !dest->Handler) {
+ _SysDebug("No handler for destination %p", dest);
+ return ;
+ }
+ _SysDebug("IPC Message 0x%x - %i bytes", info->ID, info->Length);
+
+ if( dest->Handler(dest, info->ID, info->Length, info->Data) )
+ ;
+ else {
+ switch( info->ID )
+ {
+ case WNDMSG_HOTKEY: {
+ const struct sWndMsg_Hotkey *mi = (void*)info->Data;
+ if( mi->ID >= MAX_HOTKEYS )
+ ; // TODO: Error when hotkey is out of range
+ else if( gAxWin3_Hotkeys[mi->ID] == 0 )
+ _SysDebug("--- Unmapped hotkey ID %i fired", mi->ID);
+ else
+ gAxWin3_Hotkeys[mi->ID]();
+ }break;
+ default:
+ _SysDebug("--- Unhandled SENDMSG %i", info->ID);
+ break;
+ }
+ }