Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RegSvr32 working but not working

20 views
Skip to first unread message

Bruce M. Axtens

unread,
Oct 26, 2008, 9:40:06 PM10/26/08
to
G'day everyone,

This is a weird one: I have a COM DLL that I wrote using ActiveState's
Perl Developers Kit. It compiles okay. RegSvr32 says that it has
registered it. But the object is not available to any user or
application, and hunting through the registry on object name or on the
various UIDs reveals that the object hasn't been registered .. at all.

Has anyone encountered anything like this, and if so, what was the
solution? BTW, all of the other COM DLLs I've written with PDK register
fine.

The source is below, in case it matters. The "ws" module is
Lingua::ZH::WordSegmenter converted to utf8 (rather than the original gbk.)

Kind regards,
Bruce.

<CODE>
# Perl Library PerlCtrl.
#
# This control provides ...
#

package BOChineseWordSegmenter;

use strict;
use warnings;
use utf8;
use ws;

use Encode;

use constant STX => chr( 2 ); #[
use constant ETX => chr( 3 ); #]
use constant FS => chr( 28 ); #^
use constant RS => chr( 30 ); #~

use constant TAB_SEPARATOR => 0;
use constant CARET_SEPARATOR => 1;
use constant FS_SEPARATOR => 2;
use constant SPACE_SEPARATOR => 3;
use constant AS_ARRAY => 4;

use feature 'switch';

our $segmenter;

sub BOChineseWordSegmenter_Setup {
my $dic = shift;
my $dic_encoding = shift;
my $separator = shift;
my $verbose = shift;

$dic_encoding = 'utf8' unless defined( $dic_encoding );
$separator = " " unless defined( $separator );
$verbose = 0 unless defined( $verbose );

if ( defined( $dic ) ) {
$segmenter = Lingua::ZH::BOChineseWordSegmenter->new( dic => $dic,
dic_encoding => $dic_encoding, seperator => $separator, verbose =>
$verbose );
} else {
$segmenter = Lingua::ZH::BOChineseWordSegmenter->new( dic_encoding
=> $dic_encoding, seperator => $separator, verbose => $verbose );
}
}

sub BOChineseWordSegmenter {
my $source = shift;
print STDERR $source;
my $sepcode = shift;
$source = encode("gbk",$source);
my $stringres = $segmenter->seg($source);
my @arrayres;

given ($sepcode) {
when (TAB_SEPARATOR) {
$stringres =~ tr/ /\t/;
return $stringres;
}
when (CARET_SEPARATOR) {
$stringres =~ tr/ /^/;
$stringres .= "^";
return $stringres;
}
when (FS_SEPARATOR) {
$stringres =~ s/ /FS/eg;
$stringres .= FS;
return $stringres;
}
when (SPACE_SEPARATOR) {
return $stringres;
}
default {
@arrayres = split( / /, $stringres );
return \@arrayres;
}
}
}

sub SetDictionary {
my ($source) = shift;
my $res = set_dic($source);
return $res;
}

1;

# Here is the %TypeLib hash. See the PerlCtrl documentation for
# information about this hash.
#

=pod

=begin PerlCtrl

%TypeLib = (
PackageName => 'BOChineseWordSegmenter',
TypeLibGUID => '{D9BED71D-308A-4E28-A1C0-CBA184BA6A4B}', # do NOT
edit this line
ControlGUID => '{A6B6A202-41D8-420A-8345-49BEE6AC07E4}', # do NOT
edit this line either
DispInterfaceIID=> '{1C7A4F37-A0E1-4AB0-9E23-C2623F99880B}', # or
this one
ControlName => 'BOChineseWordSegmenter',
ControlVer => 2, # increment if new object with same ProgID
# create new GUIDs as well
ProgID => 'BOChineseWordSegmenter.BOCWS',
LCID => 0,
DefaultMethod => '',
Methods => {
'ChineseWordSegmenter' => {
DispID => 1,
RetType => VT_VARIANT,
TotalParams => 2,
NumOptionalParams => 1,
ParamList =>
[ 'source' => VT_BSTR,
'sepcode' => VT_I4
]
},
'ChineseWordSegmenter_Setup' => {
DispID => 2,
RetType => VT_VARIANT,
TotalParams => 4,
NumOptionalParams => 4,
ParamList =>
[ 'dic' => VT_BSTR,
'dic_encoding' => VT_BSTR,
'separator' => VT_BSTR,
'verbose' => VT_BSTR
]
}
}, # end of 'Methods'
Properties => {
TAB_SEPARATOR => {
DocString => "Separate items with TAB (0x0)",
Type => VT_I4,
DispID => 3,
ReadOnly => 1,
},
CARET_SEPARATOR => {
DocString => "Separate items with ^ (0x1)",
Type => VT_I4,
DispID => 4,
ReadOnly => 1,
},
FS_SEPARATOR => {
DocString => "Separate items with ascii 28 (0x2)",
Type => VT_I4,
DispID => 5,
ReadOnly => 1,
},
SPACE_SEPARATOR => {
DocString => "Separate items with space (0x3)",
Type => VT_I4,
DispID => 6,
ReadOnly => 1,
},
AS_ARRAY => {
DocString => "Separate items as array (0x4)",
Type => VT_I4,
DispID => 7,
ReadOnly => 1,
}
} # end of 'Properties'
); # end of %TypeLib

=end PerlCtrl

=cut
</CODE>

bruce_axtens.vcf

Kerem Gümrükcü

unread,
Oct 27, 2008, 1:51:50 AM10/27/08
to
Hi Bruce,

i am not a PDK user but from experience i can tell
you, that you should check the DllRegister exports
code and what it internally does, since this is what
the regsvr32 calls and this code is creating the registry
keys for your com server/proxy, etc,...

You can track the registry for changes with sysinternal
tools like regmon or procmon, just to make sure!

regards

Kerem

"Bruce M. Axtens" <bruce....@gmail.com> schrieb im Newsbeitrag
news:ge3660$2t6l$1...@adenine.netfront.net...

Bruce M. Axtens

unread,
Oct 28, 2008, 8:38:28 PM10/28/08
to
Kerem Gümrükcü wrote:
> i am not a PDK user but from experience i can tell
> you, that you should check the DllRegister exports
> code and what it internally does, since this is what
> the regsvr32 calls and this code is creating the registry
> keys for your com server/proxy, etc,...
>
> You can track the registry for changes with sysinternal
> tools like regmon or procmon, just to make sure!
>
Good advice, Kerem, and thank you. I shall try that out.

Kind regards,
Bruce.

P.S. I've asked this question on IT Toolbox, StackOverflow,
ActiveState's PDK Community Forum, and even Experts Exchange. Lots of
people read it, but no one answers. I come here, sans flashy
browser-based interfaces etc., and get an answer. Usenet still rules!

bruce_axtens.vcf
0 new messages