static VALUE
foletype_s_progids(VALUE self)
{
HKEY hclsids, hclsid;
DWORD i;
LONG err;
VALUE clsid;
VALUE v = rb_str_new2("");
VALUE progids = rb_ary_new();
err = reg_open_key(HKEY_CLASSES_ROOT, "CLSID", &hclsids);
if(err != ERROR_SUCCESS) {
return progids;
}
for(i = 0; ; i++) {
clsid = reg_enum_key(hclsids, i);
if (clsid == Qnil)
break;
err = reg_open_vkey(hclsids, clsid, &hclsid);
if (err != ERROR_SUCCESS)
continue;
if ((v = reg_get_val2(hclsid, "ProgID")) != Qnil)
rb_ary_push(progids, v);
if ((v = reg_get_val2(hclsid, "VersionIndependentProgID")) != Qnil)
rb_ary_push(progids, v);
RegCloseKey(hclsid);
}
RegCloseKey(hclsids);
return progids;
}