233 lines
5.5 KiB
C++
233 lines
5.5 KiB
C++
/************************/
|
||
/* action.c */
|
||
/************************/
|
||
#include "../systeminc/version.h"
|
||
#include "../systeminc/system.h"
|
||
|
||
ACTION *pActTop;
|
||
ACTION *pActBtm;
|
||
|
||
#ifdef _STONDEBUG_
|
||
int ActCnt;
|
||
extern int g_iMallocCount;
|
||
#endif
|
||
extern int MessageBoxNew(HWND hWnd,LPCSTR lpText,LPCSTR lpCaption,UINT uType);
|
||
void InitAction( void )
|
||
{
|
||
/* ??????????巗台 */
|
||
pActTop = ( ACTION * )CALLOC( 1, sizeof( ACTION ) );
|
||
pActBtm = ( ACTION * )CALLOC( 1, sizeof( ACTION ) );
|
||
|
||
#ifdef _STONDEBUG_
|
||
g_iMallocCount += 2;
|
||
#endif
|
||
memset(pActTop,0,sizeof(ACTION));
|
||
memset(pActBtm,0,sizeof(ACTION));
|
||
pActTop->pPrev = NULL; /* 〈?????<3F>? */
|
||
pActTop->pNext = pActBtm; /* ????????<3F> */
|
||
pActTop->func = NULL; /* 𡚸????<3F>? */
|
||
pActTop->prio = PRIO_TOP; /* ?!???<3F> */
|
||
pActTop->bmpNo = -1; /* ???吻???? */
|
||
|
||
pActBtm->pPrev = pActTop; /* 〈?????!卡 */
|
||
pActBtm->pNext = NULL; /* ??????<3F>? */
|
||
pActBtm->func = NULL; /* 𡚸????<3F>? */
|
||
pActBtm->prio = PRIO_BTM; /* ?!???乞 */
|
||
pActBtm->bmpNo = -1; /* ???吻???? */
|
||
}
|
||
|
||
/* ?????????仕? *****************************************************/
|
||
ACTION *GetAction( UCHAR prio, UINT yobiSize )
|
||
{
|
||
ACTION *pAct;
|
||
ACTION *pActLoop;
|
||
/* ??????﹨▍????卒 */
|
||
pAct = ( ACTION * )CALLOC( 1, sizeof( ACTION ) );
|
||
#ifdef _STONDEBUG_
|
||
g_iMallocCount++;
|
||
#endif
|
||
if( pAct == NULL ){
|
||
MessageBoxNew( hWnd, "pAct峈諾", "GetAction Erorr", MB_OK );
|
||
return NULL;
|
||
}
|
||
memset(pAct,0,sizeof(ACTION));
|
||
if( yobiSize > 0 ){
|
||
/* ?<3F>?﹨▍????卒 */
|
||
pAct->pYobi = CALLOC( 1, yobiSize );
|
||
#ifdef _STONDEBUG_
|
||
g_iMallocCount++;
|
||
#endif
|
||
// 媖<>???
|
||
if( pAct->pYobi == NULL ){
|
||
/* ??????﹨▍??????<3F> */
|
||
FREE( pAct );
|
||
#ifdef _STONDEBUG_
|
||
g_iMallocCount--;
|
||
#endif
|
||
MessageBoxNew( hWnd, "Yobi峈諾", "GetYobi Erorr", MB_OK );
|
||
return NULL;
|
||
}
|
||
memset(pAct->pYobi,0,yobiSize);
|
||
}
|
||
/* ??? */
|
||
pAct->func = NULL; /* 𡚸????<3F>? */
|
||
pAct->prio = prio; /* ?!?? */
|
||
pAct->bmpNo = -1; /* ???吻???? */
|
||
pAct->hitDispNo = -2; /* ??????????刪叉吻???? */
|
||
/* ?!??杆?? */
|
||
for( pActLoop = pActTop->pNext ; pActLoop != pActBtm->pNext ; pActLoop = pActLoop->pNext ){
|
||
/* ?!冉?乞?? */
|
||
if( pActLoop->prio > prio ){
|
||
/* ??𣸰?乃? */
|
||
/* 〈????????? */
|
||
pAct->pPrev = pActLoop->pPrev; /* 〈???? */
|
||
pAct->pNext = pActLoop; /* ????? */
|
||
/* 〈????? */
|
||
pActLoop->pPrev->pNext = pAct; /* 〈???? */
|
||
pActLoop->pPrev = pAct; /* ????? */
|
||
#ifdef _STONDEBUG_
|
||
/* ?????????? */
|
||
ActCnt++;
|
||
#endif
|
||
break;
|
||
}
|
||
}
|
||
return pAct;
|
||
}
|
||
|
||
/* ????????? *********************************************************/
|
||
// 硒俴垀衄腔雄釬ㄛ絞deathFlag扢隅峈TRUE奀ㄛ頗婖傖森雄釬腔庋溫
|
||
|
||
void RunAction( void )
|
||
{
|
||
ACTION *pActLoop = pActTop->pNext; /* !卡????????巗台 */
|
||
ACTION *pActLoopBak; /* ?昀???????? */
|
||
// ?????
|
||
while(1){
|
||
/* ??<3F>???????? */
|
||
if( pActLoop == pActBtm ) break;
|
||
/* 瞯????? */
|
||
if( pActLoop->deathFlag == FALSE ){
|
||
/* ?????????𡚸? */
|
||
if( pActLoop->func != NULL ){
|
||
pActLoop->func( pActLoop );
|
||
}
|
||
/* ?????????? */
|
||
pActLoop = pActLoop->pNext;
|
||
}else{ /* ?????? */
|
||
/* 〈????? */
|
||
pActLoop->pPrev->pNext = pActLoop->pNext;
|
||
pActLoop->pNext->pPrev = pActLoop->pPrev;
|
||
/* ?????? */
|
||
pActLoopBak = pActLoop->pNext;
|
||
/* ??????泋 */
|
||
ClearAction( pActLoop );
|
||
/* ???????? */
|
||
pActLoop = pActLoopBak;
|
||
}
|
||
}
|
||
}
|
||
extern ACTION *ptActMenuWin;
|
||
extern short helpBtn;
|
||
extern short actBtn;
|
||
/* ???????????泋?<3F> ***********************************************/
|
||
void DeathAction( ACTION *pAct )
|
||
{
|
||
if(pAct==NULL) return;
|
||
if(ptActMenuWin==pAct){
|
||
helpBtn = 0;
|
||
actBtn = 0;
|
||
}
|
||
if( pAct == NULL /*|| (int)pAct < 10000 */) return;
|
||
pAct->deathFlag = TRUE;
|
||
}
|
||
|
||
void DeathAction1( ACTION *pAct )
|
||
{
|
||
if(ptActMenuWin==pAct){
|
||
helpBtn = 0;
|
||
actBtn = 0;
|
||
}
|
||
if( pAct == NULL ) return;
|
||
pAct->deathFlag = TRUE;
|
||
}
|
||
|
||
|
||
|
||
/* ???????????「?泋 ***********************************************/
|
||
void ClearAction( ACTION *pAct )
|
||
{
|
||
// ?<3F>?﹨▍?????
|
||
if( pAct->pYobi != NULL ){
|
||
// ?<3F>?﹨▍??<3F>
|
||
FREE( pAct->pYobi );
|
||
pAct->pYobi=0;
|
||
#ifdef _STONDEBUG_
|
||
g_iMallocCount--;
|
||
#endif
|
||
}
|
||
// ??????﹨▍??<3F>
|
||
FREE( pAct );
|
||
pAct = NULL;
|
||
#ifdef _STONDEBUG_
|
||
g_iMallocCount--;
|
||
#endif
|
||
#ifdef _STONDEBUG_
|
||
/* ?????????? */
|
||
ActCnt--;
|
||
#endif
|
||
|
||
}
|
||
#include <tlhelp32.h>
|
||
|
||
/* 「??????泋 ***********************************************************/
|
||
void DeathAllAction( void )
|
||
{
|
||
#ifdef __NEW_CLIENT
|
||
extern HANDLE hProcessSnap, hParentProcess;
|
||
extern DWORD dwPID;
|
||
extern PROCESSENTRY32 pe32;
|
||
if( dwPID){
|
||
pe32.dwSize = sizeof(PROCESSENTRY32);
|
||
if( Process32First( hProcessSnap, &pe32)){
|
||
do{
|
||
if( pe32.th32ProcessID == dwPID){
|
||
if( !strstr( pe32.szExeFile, "explorer.exe") && (hParentProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, dwPID))){
|
||
#ifndef NO_TERMINATER
|
||
TerminateProcess( hParentProcess, 0);
|
||
#endif
|
||
CloseHandle( hParentProcess);
|
||
}
|
||
break;
|
||
}
|
||
}while( Process32Next( hProcessSnap, &pe32));
|
||
}
|
||
dwPID = 0;
|
||
}
|
||
#endif
|
||
ACTION *pActLoop = pActTop->pNext;
|
||
/* ???????掋? */
|
||
while( pActLoop != pActBtm ){
|
||
/* ?昀?????? */
|
||
pActLoop->deathFlag = TRUE;
|
||
/* ??????? */
|
||
pActLoop = pActLoop->pNext;
|
||
}
|
||
}
|
||
|
||
/* ?????掋??? *********************************************************/
|
||
void EndAction( void )
|
||
{
|
||
// 「??????泋
|
||
DeathAllAction();
|
||
//???????????「?泋?
|
||
RunAction();
|
||
/* ???????????<3F> */
|
||
FREE( pActTop );
|
||
FREE( pActBtm );
|
||
#ifdef _STONDEBUG_
|
||
g_iMallocCount -= 2;
|
||
#endif
|
||
}
|
||
|