本地用户组的问题[在线等]
好久没来了,提个问题先
2000的系统,计算机管理中的用户管理显示红×,并提示:无法访问计算机xxx.错误是:库没有注册.
哪位知道是哪个库没注册吗?高分相送.
在线等
问题点数:100、回复次数:15Top
1 楼icuc88(职业特种兵)回复于 2005-03-03 14:46:38 得分 15
RPC服务是否启动?
是否为DC?Top
2 楼scz123(小章 http://blog.csdn.net/scz123/)回复于 2005-03-03 14:58:01 得分 0
已启动RPC
非DC
2000 pro的系统Top
3 楼ljf982713(电脑学习者)回复于 2005-03-03 15:12:23 得分 15
不清楚,UP!Top
4 楼icuc88(职业特种兵)回复于 2005-03-03 15:15:10 得分 3
哦,那看日志里面是否有什么错误,考虑修复错误先Top
5 楼scz123(小章 http://blog.csdn.net/scz123/)回复于 2005-03-03 15:20:12 得分 0
日志检查无错误或警告日志Top
6 楼icuc88(职业特种兵)回复于 2005-03-03 15:37:49 得分 3
Remote Registry这个服务是否开启了?Top
7 楼scz123(小章 http://blog.csdn.net/scz123/)回复于 2005-03-03 16:34:37 得分 0
Remote Registry也开者
应该跟这个服务没关系,因为我用电脑一般是关掉这个服务,用用户管理时都很正常.
希望能提供之间注册某个文件的方法进行,我不喜欢用关盘安装修复
这样也能了解是什么原因造成的Top
8 楼scz123(小章 http://blog.csdn.net/scz123/)回复于 2005-03-04 09:12:56 得分 0
通过昨晚的思考、分析和对比,总算发现问题原因.
运行用户管理(usrmgr.msc)时会加载activeds.dll
文件共享权限管理时会加载activeds.tlb
尝试将activeds.tlb删除就会出现同样问题,所以估计就是activeds.tlb没注册。
早上到网上找了段代码,然后在问题机上把activeds.tlb注册后,问题得到解决。
Option Explicit
'
' Brad Martinez, http://www.mvps.org
'
Declare Function LoadTypeLib Lib "oleaut32" _
(ByVal szFileName As String, _
lplptlib As Any) As Long ' lplptlib As Long
Declare Function RegisterTypeLib Lib "oleaut32" _
(ByVal ptlib As Any, _
ByVal szFullPath As String, _
ByVal szHelpDir As String) As Long
Declare Function UnRegisterTypeLib Lib "oleaut32" _
(GUID As GUID, _
ByVal wVerMajor As Long, _
ByVal wVerMinor As Long, _
ByVal lcid As Long, _
ByVal SYSKIND As SYSKIND) As Long
Public Const S_OK = 0 ' indicates successful HRESULT
' "Error accessing the OLE registry." Typically means that
' the GUID passed to UnRegisterTypeLib wasn't found in
' the registry (i.e the typelib was already unregistered)
Public Const TYPE_E_REGISTRYACCESS = &H8002801C
Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" (pDest As Any, pSource As Any, ByVal dwLength As Long)
Declare Function LocalAlloc Lib "kernel32" (ByVal uFlags As Long, ByVal uBytes As Long) As Long
Declare Function LocalSize Lib "kernel32" (ByVal hMem As Long) As Long
Declare Function LocalFree Lib "kernel32" (ByVal hMem As Long) As Long
' LocalAlloc uFlags values
Public Const LMEM_FIXED = &H0
Public Const LMEM_ZEROINIT = &H40
Public Const LPTR = (LMEM_FIXED Or LMEM_ZEROINIT)
Declare Function FormatMessage Lib "kernel32" Alias "FormatMessageA" _
(ByVal dwFlags As FM_dwFlags, _
lpSource As Any, _
ByVal dwMessageId As Long, _
ByVal dwLanguageId As Long, _
ByVal lpBuffer As String, _
ByVal nSize As Long, _
Arguments As Any) As Long
Public Enum FM_dwFlags
' FORMAT_MESSAGE_ALLOCATE_BUFFER = &H100
' FORMAT_MESSAGE_ARGUMENT_ARRAY = &H2000
' FORMAT_MESSAGE_FROM_HMODULE = &H800
' FORMAT_MESSAGE_FROM_STRING = &H400
FORMAT_MESSAGE_FROM_SYSTEM = &H1000
FORMAT_MESSAGE_IGNORE_INSERTS = &H200
FORMAT_MESSAGE_MAX_WIDTH_MASK = &HFF
End Enum
' FormatMessage dwLanguageId value
Public Const LANG_USER_DEFAULT = &H400&
'
' Registers the specified typelib.
' sTypelibPath - typelib's path, either explicit, or relative if the system can find it
' sHelpPath - typelib's help file path, should be explicit
' fSilent - specifies that a messagebox will not be shown indicating the result of the function
' Returns True on success, False otherwise.
Public Function RegTypelib(sTypelibPath As String, _
Optional sHelpPath As String = vbNullChar, _
Optional fSilent As Boolean = False) As Boolean
Dim hr As Long
' Dim lptlb As Long
Dim itlb As ITypeLib
hr = LoadTypeLib(StrConv(sTypelibPath, vbUnicode), itlb)
If (hr = S_OK) Then
hr = RegisterTypeLib(itlb, StrConv(sTypelibPath, vbUnicode), _
StrConv(sHelpPath, vbUnicode))
End If
If (fSilent = False) Then
If (hr = S_OK) Then
MsgBox "Successfully registered " & sTypelibPath
RegTypelib = True
Else
MsgBox "Failed to register " & sTypelibPath & _
vbCrLf & vbCrLf & GetAPIErrStr(hr), vbExclamation
End If
End If
End Function
' Unregisters the specified typelib.
' sTypelibPath - typelib's path, either explicit, or relative if the system can find it
' fSilent - specifies that a messagebox will not be shown indicating the result of the function
' Returns True on success, False otherwise.
Public Function UnregTypelib(sTypelibPath As String, _
Optional fSilent As Boolean = False) As Boolean
Dim hr As Long
Dim itlb As ITypeLib
Dim lptlba As Long
Dim tlba As TLIBATTR
hr = LoadTypeLib(StrConv(sTypelibPath, vbUnicode), itlb)
If (hr = S_OK) Then
' can't do this since VB DWORD aligns the struct !!! (it has 3 WORD members)
' If itlb.GetLibAttr(tlba) = S_OK Then
' allocate memory for the TLIBATTR struct
lptlba = LocalAlloc(LPTR, Len(tlba))
hr = Err.LastDllError
If lptlba Then
' Fill the struct's pointer
hr = itlb.GetLibAttr(lptlba)
If (hr = S_OK) Then
' Fill the struct from its pointer
' VB doesn't DWORD align the struct on this call... (?)
MoveMemory tlba, ByVal lptlba, Len(tlba)
' Unregister the typelib using the info from the TLIBATTR struct
With tlba
hr = UnRegisterTypeLib(.GUID, .wMajorVerNum, .wMinorVerNum, .lcid, .SYSKIND)
End With
' Don't do this since we're de-allocating
' below what we allocated above
' Call itlb.ReleaseTLibAttr(tlba)
' Set itlb = Nothing
End If
Call LocalFree(lptlba)
End If ' lptlba
End If ' LoadTypeLib
If (fSilent = False) Then
If (hr = S_OK) Then
MsgBox "Successfully unregistered " & sTypelibPath
UnregTypelib = True
ElseIf (hr = TYPE_E_REGISTRYACCESS) Then
MsgBox "Type library is not registered: " & sTypelibPath
Else
MsgBox "Failed to unregister " & sTypelibPath & _
vbCrLf & vbCrLf & GetAPIErrStr(hr), vbExclamation
End If
End If
UnregTypelib = (hr = S_OK)
End Function
' Returns the system-defined description of an API error code
Public Function GetAPIErrStr(dwErrCode As Long) As String
Dim sErrDesc As String * 256 ' max string resource len
If FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM Or _
FORMAT_MESSAGE_IGNORE_INSERTS Or _
FORMAT_MESSAGE_MAX_WIDTH_MASK, _
ByVal 0&, dwErrCode, LANG_USER_DEFAULT, _
ByVal sErrDesc, 256, 0) Then
GetAPIErrStr = Left$(sErrDesc, InStr(sErrDesc, vbNullChar) - 1)
End If
End Function
Top
9 楼scz123(小章 http://blog.csdn.net/scz123/)回复于 2005-03-04 09:18:37 得分 0
中午再散分,要去开工了Top
10 楼223xh(大头菜)回复于 2005-03-04 09:21:11 得分 15
注册还要那么长段B程序啊Top
11 楼jjwscn(仅仅懂一点)回复于 2005-03-04 09:28:14 得分 15
学习钻研的精神Top
12 楼lb118116(小乖乖)回复于 2005-03-04 09:43:52 得分 15
太厉害了,注册都要那么长的代码哈
Top
13 楼icuc88(职业特种兵)回复于 2005-03-04 09:50:43 得分 4
晕,用regsvr32不可以注册?Top
14 楼scz123(小章 http://blog.csdn.net/scz123/)回复于 2005-03-04 11:02:37 得分 0
regsvr32 只能注册dll,ocx等有DllRegiesterServer输入点的类库
Top
15 楼sungod8(琤) (Heros Ⅲ 凤凰)回复于 2005-03-04 12:34:55 得分 15
goodTop




