У нас есть управляемая C ++ DLL, которая при регистрации в regasm добавляет некоторые ненужные типы в реестр.
Внутри класса Blah все личные переменные, использующие MyTeam.ManagedAutoPtr, добавляются в реестр.
На данный момент у меня вопрос, возможно ли отладить, почему что-то добавляется в реестр? regasm / verbose не помог
[HKEY_CLASSES_ROOT\MyTeam.ManagedAutoPtr<MyTeam::CustomType>]
@="MyTeam.ManagedAutoPtr<MyTeam::CustomType >"
[HKEY_CLASSES_ROOT\MyTeam.ManagedAutoPtr<MyTeam::CustomType >\CLSID]
@="{039DEE72-0D73-3DCC-84AC-900E6F734715}"
[HKEY_CLASSES_ROOT\CLSID\{039DEE72-0D73-3DCC-84AC-900E6F734715}]
@="MyTeam.ManagedAutoPtr<MyTeam::CustomType>"
[HKEY_CLASSES_ROOT\CLSID\{039DEE72-0D73-3DCC-84AC-900E6F734715}\InprocServer32]
@="mscoree.dll""ThreadingModel"="Both""Class"="MyTeam.ManagedAutoPtr<MyTeam::CustomType>""Assembly"="BlahsNamespace.Blah, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null""RuntimeVersion"="v4.0.30319"
Соответствующая часть Бла является:
public ref class Blah
{
private:
MyTeam::ManagedAutoPtr<MyTeam::CustomType> _variable;
}
И, наконец, это ManagedAutoPtr в полном объеме
template <typename T> public ref class ManagedAutoPtr {
// This implementation is taken from
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/CplusCLIBP.asp
public:
/**
* Constructs an zero pointer.
*/
ManagedAutoPtr() : _p(0) {}
/**
* Constructs a pointer that references the given T instance. This
* ManagedAutoPtr will take ownership of @a *ptr.
*/
ManagedAutoPtr(T* ptr) : _p(ptr) {}
/**
* Constructs a pointer that references the same T instance as @a other.
* This ManagedAutoPtr will take over the ownership of the T instance,
* while @a other will lose it. @a other may represent a zero pointer.
*/
ManagedAutoPtr(ManagedAutoPtr<T>% other) : _p(other.release()) {}
/**
* Constructs a pointer that references the same T instance as @a other.
* This ManagedAutoPtr will take over the ownership of the T instance,
* while @a other will lose it. @a other may represent a zero pointer.
*/
template<typename Derived>
ManagedAutoPtr(ManagedAutoPtr<Derived>% other) : _p(other.release()) {}
/**
* Constructs a pointer that references the same T instance as @a other.
* This ManagedAutoPtr will take over the ownership of the T instance,
* while @a other will lose it. @a other may represent a zero pointer.
*/
template<typename Derived>
ManagedAutoPtr(esp::auto_ptr<Derived>& other) : _p(other.release()) {}
/**
* A finalizer that deletes any T instance that it might still hold.
*/
!ManagedAutoPtr() {
delete _p;
_p = 0;
}
/**
* Destroys this ManagedAutoPtr, and deletes any T instance it might
* reference.
*/
~ManagedAutoPtr() {
this->!ManagedAutoPtr();
}
/**
* Returns a raw pointer to the T instance referenced by this
* ManagedAutoPtr, if any.
*/
T* get() {
return _p;
}
/**
* Causes this ManagedAutoPtr to lose its ownership of the T
* instance that it is referencing (if any). A raw pointer to this T
* instance will be returned (or the zero pointer if this ManagedAutoPtr
* did not own any T instance).
*/
T* release() {
T* released = _p;
_p = 0;
return released;
}
/**
* Causes this ManagedAutoPtr to take ownership of the T instance
* pointed to by @a ptr. The T instance currently owned by this
* ManagedAutoPtr (if any) will be deleted. @a ptr may be zero.
*/
void reset(T* ptr) {
if (ptr != _p) {
delete _p;
_p = ptr;
}
}
/**
* Sets this ManagedAutoPtr to zero. The T instance owned
* by this ManagedAutoPtr (if any) will be deleted.
*/
void reset() {
reset(0);
}
/**
* Returns a reference to the T instances owned by
* @a autoPtr.
*
* @pre autoPtr.get() != 0
*/
static T& operator*(ManagedAutoPtr<T>% autoPtr) {
return *autoPtr._p;
}
/**
* Returns a non-zero raw pointer to the T instance referenced by this
* ManagedAutoPtr.
*
* @pre get() != 0
*/
static T* operator->(ManagedAutoPtr<T>% autoPtr) {
ESP_ASSERT(autoPtr._p != 0);
return autoPtr._p;
}
/**
* Assigns @a other to this ManagedAutoPtr. @a other loses the ownership of
* the T instance, and this ManagedAutoPtr gains the ownership.
*/
ManagedAutoPtr<T>% operator=(ManagedAutoPtr<T>% other) {
if (this != %other) {
reset(other.release());
}
return *this;
}
/**
* Assigns @a other to this ManagedAutoPtr. @a other loses the ownership of
* the T instance, and this ManagedAutoPtr gains the ownership.
*/
template<typename Derived>
ManagedAutoPtr<T>% operator=(ManagedAutoPtr<Derived>% other) {
reset(other.release());
return *this;
}
/**
* Assigns @a other to this ManagedAutoPtr. @a other loses the ownership of
* the T instance, and this ManagedAutoPtr gains the ownership.
*/
template<typename Derived>
ManagedAutoPtr<T>% operator=(esp::auto_ptr<Derived>& other) {
reset(other.release());
return *this;
}
private:
T* _p;
};
До, нашел его, соответствующим инструментом является ildasm (также в командной строке VS). Богатство информации о том, какие типы есть в сборке.
Других решений пока нет …