请问:(请讲的详细些,本人水平有限.)
 1.copymemory,zeromemory的作用是什么?
2.能获得信息分别是什么?
3.以下表示的内容是什么     Public  Declare  Sub  CopyMemory  Lib  "kernel32"  Alias  "RtlMoveMemory"  (Destination  As  Any,  Source  As  Any,  ByVal  Length  As  Long)      
                       Private    Type    HOSTENT      
                                 hname    As    Long      
                                 hAliases    As    Long      
                                 hAddrType    As    Integer      
                                 hLength    As    Integer      
                                 hAddrList    As    Long      
                       End    Type      
                                 Dim    hostent_addr    As    Long      
                                 Dim    host    As    HOSTENT      
                                 Dim    hostip_addr    As    Long      
                                 Dim    temp_ip_address()   As  Byte      
                                 Dim    i    As    Integer      
                                 Dim    ip_address    As    String      
   RtlMoveMemory    host,    hostent_addr,    LenB(host)      
   RtlMoveMemory    hostip_addr,    host.hAddrList,    4      
 copymemory的Destination的类型定义引出host,host引出hostent,这些定义作用?  
 

解决方案 »

  1.   

    copymemory将一个内存块中的内容拷贝到另外一个内存块中
    zeromemory将一个内存块中的内容清0。
      

  2.   

    3:
     hostent 是socket中主机信息的结构体, gethostbyname gethostbyaddr传回该结构体的指针
    host属于hostent结构体, 
    hostip_addr,host.hAddrList为一指向指针a的指针
    指针a  指向有主机字节排列的ip地址1
    指针a+1  指向有主机字节排列的ip地址2
    读去IP的方法是
    RtlMoveMemory hostip_addr,  host.hAddrList, 4  读出 char **
    dim hostIp_addr_1 as long
    dim hostIp_1 as long
     RtlMoveMemory hostIp_addr_1, byval hostip_addr, 4 读出 char *
     RtlMoveMemory hostIp_1, byval hostIp_addr_1, 4 读出 char * 中的4个字节, ip地址
    dim ip_1 as string, ip_2 as string, ip_3 as string, ip_4 as string
     ip_4 = hostIp_1 mod 256: hostIp_1 = hostIp_1 \ 256
     ip_3 = hostIp_1 mod 256: hostIp_1 = hostIp_1 \ 256
     ip_2 = hostIp_1 mod 256: hostIp_1 = hostIp_1 \ 256
     ip_1 = hostIp_1 
    debug.print ip_1 & "." & ip_2 & "." & ip_3 & "." ip_4  
      

  3.   

    哦,写错了,  是网络顺序
    debug.print ip_4 & "." & ip_3 & "." & ip_2 & "." ip_1