Esempio n. 1
0
static int  ProcessDeluser(U16 pin, HWND hWnd, int delupass)
{
	int fpcheck=0, pwdcheck=0, basecheck=0;
	int hidcheck=0;		//liming
	int photocheck=0;

	char delhintbuff[100];
	int delcount=0;
	TUser duser;

	delret=0;
	memset(delhintbuff,0,100);

	//delall
	if (delupass==0)
	{
		sprintf(delhintbuff,"%s?",LoadStrByID(MID_USEBASE));
		basecheck=1;
	}

	//delfp
	if (delupass==1)
	{
		sprintf(delhintbuff,"%s?",LoadStrByID(HID_DEL_FP));
		fpcheck=1;
	}

	//delpwd
	if (delupass==2)
	{
		sprintf(delhintbuff,"%s?",LoadStrByID(HID_DEL_PWD));
		pwdcheck=1;
	}

	//delhid
	if (delupass==3)
	{
		sprintf(delhintbuff,"%s?",LoadStrByID(MID_DEL_CARD));
		hidcheck=1;
	}

	//delphoto
	if (delupass==4)
	{
		sprintf(delhintbuff,"%s?", LoadStrByID(MID_QUERY_SET1));
		photocheck=1;
	}

	//For face
#ifdef FACE
	int facecheck=0;
	if (delupass==5)
	{
		sprintf(delhintbuff,"%s%s?", LoadStrByID(MID_REMOVEHINT), LoadStrByID(MID_DEL_FACE));
		facecheck=1;
	}
#endif
	//end face

	if (MessageBox1 (hWnd,delhintbuff, LoadStrByID(MID_APPNAME), MB_OKCANCEL | MB_ICONQUESTION | MB_BASEDONPARENT) != IDOK)
	{
		delret=0;
		return 0;
	}

	//提示清除管理员权限
	memset(&duser, 0, sizeof(TUser));
	FDB_GetUser(pin, &duser);
	if(delupass>0 && ((nopwd && nofp)||(nopwd && nohid)||(nofp && nohid)) && duser.Privilege==(BYTE)PRIVILLEGE3)
	{
		if(MessageBox1(hWnd,LoadStrByID(MID_ADUSER_HINT),LoadStrByID(MID_APPNAME),MB_OKCANCEL|MB_ICONINFORMATION|MB_BASEDONPARENT)==IDOK)
		{
			int j=0;
			duser.Privilege=0;
			j=FDB_ChgUser(&duser);
			FDB_AddOPLog(ADMINPIN, OP_CLEAR_ADMIN,duser.PIN,j,0,0);
		}
		else
			return 0;
	}
	//
	//delete photo
	if (photocheck)
	{
		HWND statushWnd;

		statushWnd=createStatusWin1(hWnd, 250, 50, LoadStrByID(MID_APPNAME), LoadStrByID(MID_PHOTO_HINT1));
		busyflag = 1;
		ProcDeleteUserPhoto();
		FDB_AddOPLog(ADMINPIN, OP_DEL_ATTPHOTO,ADMINPIN,0,0,0);
		destroyStatusWin1(statushWnd);
		nophoto=1;
		delret=5;
		InvalidateRect(hWnd,NULL,TRUE);
		SendMessage(btndelphoto, MSG_ENABLE, 0, 0);
		photodelhint=1;
		SetMenuTimeOut(time(NULL));
		SetFocusChild(btnexit2);
	}

	//delete hid
	if (hidcheck)
	{
		TUser uh;
		memset(&uh,0,sizeof(TUser));
		if(FDB_GetUser(pin,&uh)!=NULL)
		{
			int j;
			memset(uh.Card,0,4);
			j=FDB_ChgUser(&uh);
			FDB_AddOPLog(ADMINPIN, OP_DEL_RFCARD,uh.PIN,j,0,0);
			delret=4;		//
			hiddelhint=1;
			InvalidateRect(hWnd,NULL,TRUE);
			SendMessage(btndelhid,MSG_ENABLE,0,0);
			nohid=1;
			SetFocusChild(btnexit2);
		}
	}

	//delete fp
	if (fpcheck)
	{	//dellfp
		int j=FDB_DeleteTmps(pin);
		FDB_AddOPLog(ADMINPIN, OP_DEL_FP,pin,j,0,0);
		delcount++;
		SendMessage(btndelfp,MSG_ENABLE,0,0);
		delret=2;
		fpdelhint=1;
		InvalidateRect(hWnd,NULL,TRUE);
		SendMessage(btndelfp,MSG_ENABLE,0,0);
		nofp=1;
		SetFocusChild(btnexit2);
	}

	if (pwdcheck)
	{
		TUser u1;
		int j;

		memset(&u1,0,sizeof(u1));
		FDB_GetUser(pin,&u1);
		nmemset((BYTE*)u1.Password, 0, sizeof(u1.Password));
		j=FDB_ChgUser(&u1);
		FDB_AddOPLog(ADMINPIN, OP_DEL_PWD,u1.PIN,j,0,0);
		delret=3;
		pwddelhint=1;
		InvalidateRect(hWnd,NULL,TRUE);
		SendMessage(btndelpwd,MSG_ENABLE,0,0);
		nopwd=1;
		SetFocusChild(btnexit2);

	}

	if (basecheck)
	{
		int j = FDB_DelUser(pin);
		FDB_AddOPLog(ADMINPIN, OP_DEL_USER,pin,j,0,0);
		if(FDB_OK==j)
		{
			if(gOptions.IsSupportSMS)
			{
				TUData tudt;
				U16 smsID;
				TSms tsms;

				if(FDB_GetUData(pin,&tudt)!=NULL)
				{
					smsID=tudt.SmsID;
					FDB_DelUData(pin,0);
					memset(&tudt,0,sizeof(TUData));
					if(FDB_GetUDataBySmsID(smsID,(PUData)&tudt)==0)
					{
						memset(&tsms,0,sizeof(TSms));
						if(FDB_GetSms(smsID,&tsms)!=NULL)
						{
							tsms.Tag=UDATA_TAG_TEMP;
							FDB_ChgSms(&tsms);
						}
					}
				}
			}

			if(gOptions.UserExtendFormat)
				FDB_DelExtUser(pin);

			if (gOptions.CameraOpen && !nophoto)
			{
				busyflag = 1;
				ProcDeleteUserPhoto();
				SetMenuTimeOut(time(NULL));
			}
			delcount++;
		}
		delret=1;
	}

#ifdef FACE
	if (facecheck)
	{
		FDB_DeleteFaceTmps(pin);
		delcount++;
		delret=6;
		facedelhint=1;
		InvalidateRect(hWnd,NULL,TRUE);
		SendMessage(btndelface,MSG_ENABLE,0,0);
		noface=1;
		SetFocusChild(btnexit2);
	}
#endif
	if (delcount>0)
	{
		sync();
		FPDBInit();
	}

	if (basecheck)
	{
		SendMessage(hWnd,MSG_CLOSE,0,0);
	}
	return 1;
}
Esempio n. 2
0
int main(NULONG magic,NADDR addr) {

  //Clear screen
  vid_clear_mem();

  /*
    Multiboot stuff
  */
  

  /* Am I booted by a Multiboot-compliant boot loader? */
  if (magic != MULTIBOOT_BOOTLOADER_MAGIC)
   panic("NoOS was not booted by a Multiboot-compliant boot loader. MAGIC_VALUE is not correct");

  multiboot_info_t *mbi;
  /* Set MBI to the address of the Multiboot information structure. */
  mbi = (multiboot_info_t *) addr;


  /* Are mem_* valid? */
  if (NCHECK_FLAG(mbi->flags,0) == 0)
    panic("NoOS detected that flag 0 in the mbi is not set. MBI_FLAGS are not correct");

  if (NCHECK_FLAG(mbi->flags,5) == 0)
    panic("NoOS detected that flog 5 in the mbi is not set. MBI_FLAGS are not correct");

  /* Init debug */
  debug_init(addr);
/*
  vid_print("Error caused in: ",0x8);
  Elf32_Sym* symbol = elf_find_sym((dword)0x1001ef);
  char* name = elf_get_str(symbol->st_name);
  vid_print(name,0x6);vid_print("\r\n",0x06); kstop();
*/
  kprint("Kernel loaded\r\n");
  kprint("Setting up IDT...\r\n");

  idt_setup_ptr();
  nmemset(&idt, 0, sizeof(struct IDTDescr)*256);
  idt_load_idt();
  idt_setup_isr();

  kprint("Creating Handlers...\r\n");

  idt_set_handlers();

  kprint("Remapping PIC...\r\n");

  pic_remap();

  kprint("Initializing GDT...\r\n");

  init_gdt();

  kprint("Initializing Memory Manager...\r\n");

  mem_init(addr);

  kprint("Setting up RPC...\r\n");

  rpc_init();

  kprint("Setting up Services..\r\n");

  srvc_init();

  kprint("Initializing Keyboard driver...\r\n");

  kbd_init();

  kprint("Initializing Video driver...\r\n");

  vid_init_drv();

  kprint("Initializing Floppy driver...\r\n");

  floppy_detect_drive();

  kprint("Initializing Memory Manager [[SERVICE]]...\r\n");

  mem_init_srvc();

  kprint("Initializing RPC [[SERVICE]]...\r\n");

  rpc_init_srvc();

  kprint("Enabling interrupts...\r\n");

 
  asm("sti");

  nash_start();

  while(1) asm("hlt");
}