常用函式庫收集

2021-03-31 08:57:01 字數 2941 閱讀 5839

unsigned

long resolv(char*host)

else

host_ip = *(u_long*)hp->h_addr ;

}

return(host_ip);

}

//校驗和演算法

unsigned

short checksum(unsigned

short*buffer,int size)

if(size)

cksum+=*(uchar*)buffer ;

cksum=(cksum>>16)+(cksum&0xffff);

cksum+=(cksum>>16);

return(unsigned

short)(~cksum);

}

//

//

根據視窗控制代碼取得檔案完整路徑。

// //

// 引數:

//hwnd

//視窗控制代碼

//lpszfilename

//獲取檔案完整路徑的緩衝區

//nsize

//緩衝區長度

//

//

返回值//

成功返回true, 出錯返回false;

//

bool getfilenamefromhwnd(hwnd hwnd, lptstr lpszfilename, dword nsize)

// 關閉控制代碼

closehandle( hprocess ) ;

} }

// 釋放psapi.dll

freelibrary( hinstlib ) ;

}

//

當系統為9x

else

if ( osverinfo.dwplatformid == ver_platform_win32_windows )

} while ( lpfprocess32next(hsnapshot, &pe) );

}

//

關閉控制代碼

closehandle(hsnapshot);

} }

else

return false;

return bresult;

}

// 根據錯誤id獲取出錯資訊

void

errortrace(const

char *msg, dword error)

}

//利用管道獲取命令列

bool

__fastcall tform1::runcmd(ansistring cmd,tstringlist *stringlist)

sa.nlength = sizeof(security_attributes);

sa.binherithandle=true;

sa.lpsecuritydescriptor=null;

ret=createpipe(&hreadpipe,&hwritepipe,&sa,0);

if(ret==0)

memset(&start,0x00,sizeof(startupinfo));

start.cb=sizeof(startupinfo);

start.dwflags=startf_usestdhandles | startf_useshowwindow;

start.hstdoutput=hwritepipe;

start.hstderror=hwritepipe;

bool retc=createprocess(null,cmd.c_str(),null,null,true, 0, 0, null, &start, &proc);

if(!retc)

closehandle(hwritepipe);

unsigned

long len;

memstream->position=0;

while(true)

else

}

closehandle(proc.hprocess);

closehandle(proc.hthread);

closehandle(hreadpipe);

memstream->position=0;

free(strbuff);

stringlist->loadfromstream(memstream);

memstream->clear();

delete memstream;

return

true;

}

//提公升程序許可權

bool enableprivilege(lpctstr lpsystemname,lpctstr lpname)

return fok ;

} 2004-11-29 7:00 pm |

zwell

//連線指定ip埠,返回socket

int conn(char *ip,int p)

printf("[x] connected to: %s on port %d./n",ip,p);

return sockfd;

}

2004-12-03 12:44 am |

zwell

//將指定程式安裝成服務

int installservice(

char *svr_name, char *display_name,char *exepath, int starttype

)

//將指定服務刪除

int autoload::deleteservicebyname(char *svr_name)

JavaScript常用函式庫

檢驗是否數字 param id 待校驗元素id returns true是數字,false相反 function chaecknum id else return true 校驗起止日期要小於結束日期 param begindateid 開始日期id param enddateid 結束日期id r...

python常用函式庫 一

python第三方資料庫 資料分析函式庫 numpy 用於數值計算 import numpy ads np pandas 主要用於做資料處理 ipython 更新到1.0後,功能基本完善,其中的notebook非常強大,而且是基於web,在合作分享方面非常好 scripy 數值計算的擴充套件包 影象...

PHP函式庫程序 常用函式歸納

雖然市場上有php手冊 但是一方面太貴,另一方面太全,因此利用php5電子手冊找了些時間為自己量身定做了一本 php秘笈 就是把常用的和比較好的一些函式庫等歸納了一下,並把php正規表示式的全部詳解 mysql的詳細指令和詳細用法 php.ini的配置詳解也收錄其中。這裡歸納一些基礎函式庫和常用擴充...