98/ME下实现文件夹的共享和删除共享[1]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 3661512 的 blog

'独立模块中输入
option explicit
' 共享错误信息
public const nerr_noworkstation = 2102           ' 工作站驱动器未被安装.
public const nerr_unknownserver = 2103           ' 机器名不可用.
public const nerr_remoteonly = 2106              ' 该操作不被机器支持.
public const nerr_servernotstarted = 2114        ' 服务未启动.
public const nerr_unknowndevdir = 2116           ' 目录或驱动器不存在.
public const nerr_redirectedpath = 2117          ' 该共享资源不能被共享.
public const nerr_duplicateshare = 2118          ' 该共享名已被使用.
public const nerr_networkerror = 2136            ' 发生一般网络错误,共享失败.
public const nerr_invalidapi = 2142              ' 该api不被远端机器所支持.

' 标准错误信息
public const error_access_denied = 5
public const error_invalid_parameter = 87
public const error_invalid_name = 123
public const error_invalid_level = 124


public declare sub copymemory lib "kernel32" alias "rtlmovememory" (lpdest as any, lpsource as any, byval lbytes as long)

' 共享类型
public const stype_disktree = 0
public const stype_printq = 1
public const stype_device = 2
public const stype_ipc = 3
public const stype_special = &h80000000

public const shi_uses_unlimited = -1&

' 共享权限
public const shi50f_rdonly = &h1
public const shi50f_full = &h2
public const shi50f_dependson = shi50f_rdonly or shi50f_full
public const shi50f_accessmask = shi50f_rdonly or shi50f_full
public const shi50f_persist = &h100
public const shi50f_system = &h200     '/* 该共享是不可见的 */
public const lm20_nnlen = 12           '// lm 2.0 机器名长度
public const lm20_unlen = 20           '// lm 2.0 用户名称最大长度
public const lm20_pwlen = 14           '// lm 2.0 密码最大长度
public const shpwlen = 8               '// 共享密码 (bytes)
public const sharelevel50 = 50

public type share_info_50
    ynetname(lm20_nnlen)    as byte         'charshi50_netname[lm20_nnlen+1];
    '/* 共享名称 */
    ytype                   as byte         ' unsigned char shi50_type;

    nflags                  as integer      ' short shi50_flags;

    lpzremark               as long         ' char far *shi50_remark;

    lpzpath                 as long         ' char far *shi50_path;
    '/* 共享路径 */
    yrwpassword(shpwlen)    as byte         ' char shi50_rw_password[shpwlen+1];
    '/* 可读/写共享密码 */
    yropassword(shpwlen)    as byte         ' char shi50_ro_password[shpwlen+1];
    '/* 只读共享密码 */
end type

public declare function netshareadd50 lib "svrapi" alias "netshareadd" _
                       (byval lpzservername as string, _
                        byval nsharelevel as integer, _
                        shareinfo as any, _
                        byval nbuffersize as integer) as long

public declare function netsharedelete lib "svrapi" alias "netsharedel" _
                       (byval lpzservername as string, _

本文关键:共享 文件夹 删除 添加
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top