Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Windows Via C/C++£ºÏß³ÌʵÏÖϸ½Ú

ÎÒÃÇÒѾ­Á˽âÈçºÎ¶¨ÒåÏß³ÌÈë¿Úµãº¯Êý¡¢µ÷ÓÃϵͳAPI´´½¨Ö´ÐÐÖ¸¶¨º¯ÊýµÄÏ̡߳£±¾½Ú½«½ÒʾÕâÒ»ÇÐÔÚϵͳÄÚ²¿ÊÇÈçºÎÍê³ÉµÄ¡£
ͼ6-1ÃèÊöÁËÏ̴߳´½¨²¢Íê³É³õʼ»¯ºóµÄ״̬¡£µ÷ÓÃCreateThread»áʹϵͳ²úÉúÒ»¸öÏß³ÌÄں˶ÔÏó£¬ÆäÒýÓüÆÊý£¨Usage count£©±»³õʼ»¯Îª2£¨´´½¨Ï̵߳Ľø³ÌºÍÏ̱߳¾Éí¶¼ÒýÓÃÁ˸ÃÄں˶ÔÏ󣩣¬ÆäËüÊôÐÔÒ²Íê³ÉÁ˳õʼ»¯£ºÔÝÍ£±êÖã¨Suspend count£©±»ÉèÖÃΪ1£¬Ïß³ÌÍ˳öÂ루Exit code£©±»ÉèÖÃΪSTILL_ACTIVE£¬Äں˶ÔÏó״̬±»ÖÃΪnonsignaled£¨Signaled£©¡£
Äں˶ÔÏó´´½¨Íê³Éºó£¬ÏµÍ³ÔÚµ±Ç°½ø³ÌÖÐΪÐÂÏ̵߳ÄÏß³ÌÕ»·ÖÅäÄڴ棬²¢ÔÚÏß³ÌÕ»µÄ¸ßλдÈëÁ½¸öÖµ¡£µÚ1¸öÖ¸ÊÇCreateThreadº¯ÊýµÄpvParam²ÎÊý£¬È»ºóÊÇpfnStartAddr²ÎÊý¡£
ÿ¸öÏß³ÌÓÐ×Ô¼ºµÄCPU¼Ä´æÆ÷×飬±»³ÆΪÏß³ÌÉÏÏÂÎÄ£¨Context£©£¬Ï̵߳ÄÉÏÏÂÎÄ·´Ó³ÁËÏß³Ì×îºóÒ»´ÎÖ´ÐÐʱÆäCPU¼Ä´æÆ÷µÄ״̬¡£WinNT.hÖж¨ÒåÁËCONTEXT½á¹¹¶ÔÓ¦Ï̵߳ÄCPU¼Ä´æÆ÷×飬Ï̵߳ÄCONTEXTʵÀý±£´æÔÚÆäÄں˶ÔÏóÖС£
Ïß³ÌÉÏÏÂÎÄÖÐ×îÖØÒªµÄÁ½¸ö¼Ä´æÆ÷ÊÇÖ¸ÁîÖ¸Õë¼Ä´æÆ÷£¨Instruction pointer£©ºÍÕ»Ö¸Õë¼Ä´æÆ÷£¨Stack pointer£©¡£ÓÉÓÚÏß³ÌÊÇÔËÐÐÔÚ½ø³ÌµØÖ·¿Õ¼äÄڵģ¬Òò´ËÆäÕ»ÖеĵØÖ·¾ÍÊǽø³ÌµØÖ·¿Õ¼äÖеĵØÖ·¡£Ïß³ÌÄں˶ÔÏó³õʼ»¯Ê±£¬ÆäCONTEXT½á¹¹ÖеÄÕ»Ö¸Õë¼Ä´æÆ÷ÄÚÈݱ»ÉèÖÃΪpfnStartAddrÔÚÏß³ÌÕ»ÖеĵØÖ·£¬Ö¸ÁîÖ¸Õë¼Ä´æÆ÷ÄÚÈݱ»ÉèÖÃΪÃûΪRtlUserThreadStartµÄº¯ÊýµÄµØÖ·£¬¸Ãº¯ÊýÔÚNTDLL.dllÖж¨Ò壬»ù±¾¿ò¼ÜÈçÏÂËùʾ£º
VOID RtlUserThreadStart(PTHREAD_START_ROUTINE pfnStartAddr, PVOID pvParam) {
__try {
ExitThread((pfnStartAddr)(pvParam));
}
__except(UnhandledExceptionFilter(GetExceptionInformation())) {
ExitProcess(GetExceptionCode());
}
// NOTE: We never get here.
}
Ï̳߳õʼ»¯Íê³Éºó£¬ÏµÍ³»á¼ì²éCreateThreadÊÇ·ñ´«µÝÁËCREATE_SUSPENDED²ÎÊý£¬Èç¹ûûÓеĻ°£¬ÏµÍ³»á°ÑÏß³ÌÄں˶ÔÏóµÄÔÝÍ£¼ÆÊýÉèÖÃΪ0²¢ÂíÉϵ÷¶ÈỊ̈߳¬È»ºó½«Ïß³ÌÉÏÏÂÎÄÖеÄÖµ¼ÓÔص½CPUµÄ¼Ä´æÆ÷×éÖУ¬ÓÉÓÚÏß³ÌÖ¸ÁîÖ¸Õë¼Ä´æÆ÷Ö¸ÏòRtlUserThreadStart£¬Òò´ËÏ߳̽«ÒÔRtlUserThreadStart¿ªÊ¼Ö´ÐУ¬RtlUserThreadStartÓÖµ÷ÓÃÁËCreateThreadΪÏß³ÌÉèÖõÄÈë¿Úµãº¯ÊýpfnStartAddr£¬²¢ÔÚpfnStartAddr·µ»Øʱµ÷ÓÃExitThreadÍ˳öÏ̡߳£Òª×¢Òâ¼ÙÈçÔÚpfnStartAddrÖ´ÐÐʱ·¢ÉúÁËδ´¦ÀíµÄÒì³££¬RtlUserThreadStartÖеĽṹ»¯Òì³£´¦Àí¿ò¼Ü½«Ö´ÐÐExitProcess£¬µ¼ÖÂÕû¸ö½ø³ÌµÄÍ˳ö¡£


Ïà¹ØÎĵµ£º

VB/C++/C#´®¿ÚͨѶԴ´úÂ롾¸½ÏêϸעÊÍ¡¿


VB
    If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
    MSComm1.CommPort = i1
    MSComm1.PortOpen = True
    MSComm1.InputMode = comInputModeBinary
    MSComm1.InBufferCount = 0
& ......

c ÄÚ´æ¶ÔÆë

µ±ÔÚC Öж¨ÒåÁËÒ»¸ö½á¹¹ÀàÐÍʱ£¬ËüµÄ´óСÊÇ·ñµÈÓÚ¸÷×Ö¶Î(field) ´óС֮ºÍ£¿±àÒëÆ÷½«ÈçºÎÔÚÄÚ´æÖзÅÖÃÕâЩ×ֶΣ¿ANSI C¶Ô½á¹¹ÌåµÄÄÚ´æ²¼¾ÖÓÐʲôҪÇ󣿶øÎÒÃǵijÌÐòÓÖÄÜ·ñÒÀÀµÕâÖÖ²¼¾Ö£¿ÕâЩÎÊÌâ»òÐí¶Ô²»ÉÙÅóÓÑÀ´Ëµ»¹ÓеãÄ£ºý£¬ÄÇô±¾ÎľÍÊÔ×Å̽¾¿ËüÃDZ³ºóµÄÃØÃÜ¡£
Ê×ÏÈ£¬ÖÁÉÙÓÐÒ»µã¿ÉÒԿ϶¨£¬ÄǾÍÊÇANSI C ±£Ö¤½á¹¹ÌåÖи÷× ......

¼òÊöCºÍC++³ÌÐòԱѧϰÀú³Ì

Ò»¼ÒÖ®ÑÔ£¬»¶Ó­ÅÄש¹þ¡£
¡¡¡¡1¡¢¿ÉÒÔ¿¼ÂÇÏÈѧϰC.
¡¡¡¡´ó¶àÊýʱºò£¬ÎÒÃÇѧϰÓïÑÔµÄÄ¿µÄ£¬²»ÊÇΪÁ˳ÉΪһ¸öÓïÑÔר¼Ò£¬¶øÊÇÏ£Íû³ÉΪһ¸ö½â¾öÎÊÌâµÄר¼Ò¡£×öÒ»¸öÓÐÓõijÌÐòÔ±£¬×öÒ»¸ö׬ǮµÄ³ÌÐòÔ±¡£ÎÒÃǵļÛÖµ£¬½«ÌåÏÖÔÚ¿Í»§¼ÛÖµÉÏ£¬¶ø²»ÊÇÓïÑÔдµÃºÃ²»ºÃ¿´¡£
¡¡¡¡C++ÊÇCµÄÒ»¸öÃæÏò¶ÔÏóµÄ½âÊÍ£¬C++ΪCÀ©³äÁË´ó¹æÄ£¹¤³ÌÓ¦ ......

ÓÃVim´î½¨C/C++¿ª·¢»·¾³

ÀîÈôÀÏʦÔø¾­Ëµ£ºÊÀ½çÉϵijÌÐòÔ±·ÖÈýÖÖ£¬Ò»ÖÖÊÇÓÃEmacs£¬Ò»ÖÖÊÇÓÃVimµÄ£¬ÆäËüµÄ¹éΪµÚÈýÖÖ¡£ÆäÒâÊÇ˵Èç¹ûÒ»¸ö³ÌÐòÔ±Á½Õ߶¼²»ÓõĻ°£¬ÄÇ´óµÖÊDz»ÄÜ
¹éΪÈëÁ÷ÕßÐÐÁеġ£¶ÔʹÓÃC/C++µÄÈËÀ´Ëµ£¬ºÜ¶àÈËϲ»¶Emacs£¬¾Ý˵Óë¶ÔStallmanµÄ³ç°ÝÓë°®Îݼ°ÎÚÓйØ;-)¡¡µ±È»£¬EmacsÓëVimËä
È»ÔÚÎı¾±à¼­·½ÃæµÄÐÔÄÜÊǵȼ۵ģ¬µ«Ê¹ÓÃÆðÀ´Á½Õ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ