Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • wine/wine
  • rbernon/wine
  • stefan/wine
  • FireBurn/wine
  • alesliehughes/wine
  • zhiyi/wine
  • huw/wine
  • jsikorski/wine
  • hmc/wine
  • dadangnh/wine
  • epo/wine
  • dlesho/wine
  • DarkShadow44/wine
  • iamahuman/wine
  • jacek/wine
  • mstorsjo/wine
  • gofman/wine
  • alexhenrie/wine
  • giomasce/wine
  • tclem/wine
  • besentv/wine
  • dlehman25/wine
  • aeikum/wine
  • cdavis5e/wine
  • sbaars/wine
  • baskanov/wine
  • pperdigao/wine
  • DavidHusicka/wine
  • DadSchoorse/wine
  • gverm/wine
  • bshanks/wine
  • gonzoMD/wine
  • Mystral/wine
  • tmatthies/wine
  • zlice/wine
  • AndreRH/wine
  • madewokherd/wine
  • zfigura/wine
  • fgouget/wine
  • nsivov/wine
  • ElementalWarrior/wine
  • piotr/wine
  • timozuccarello/wine
  • DavidCurtiss/wine
  • cmcadams/wine
  • davidebeatrici/wine
  • hans/wine
  • insn/wine
  • danrm/wine
  • jklemann/wine
  • saedo/wine
  • sgwaki/wine
  • puetzk/wine
  • bernhardu/wine
  • ReDress/wine
  • jlucfarias/wine
  • sloper42/wine
  • ivyl/wine
  • zhui/wine
  • julliard/wine
  • ClearlyClaire/wine
  • Alexander-Wilms/wine
  • rndtrash/wine
  • redmcg/wine
  • jkfloris/wine
  • maljaf/wine
  • Tuupertunut/wine
  • bsjeon/wine
  • tati/wine
  • whydoubt/wine
  • doitsujin/wine
  • shaunren/wine
  • szanni/wine
  • tobi.goergens/wine-cabinet-patch
  • winspool/wine
  • olivierfrdierick/wine
  • linkmauve/wine
  • jin-king1/wine
  • yeyeshun/wine
  • sulix/wine
  • bgc/wine
  • fanwenjie/wine
  • IncubusRK/wine
  • js6pak/wine
  • AurimasF/wine
  • etaash.mathamsetty/wine
  • hverbeet/wine
  • Fox2Code/wine
  • jhol/wine
  • jrueger/wine
  • afrantzis/wine
  • lauri.kentta/wine
  • ehoover/wine
  • cdenton/wine
  • jkloetzke/wine
  • baryluk/wine
  • restet/wine-personal
  • orudge/wine
  • Gcenx/wine
  • mstefani/wine
  • hibbsncc1701/wine
  • jchw/wine
  • moceap/wine
  • Skryptonyte/wine
  • marzent/wine
  • msmeissn/wine
  • learn-more/wine
  • logos128/wine
  • xe/wine
  • florian-kuebler/wine
  • eason329/wine
  • gang65/wine
  • binarymaster/wine
  • nbosio1001/wine
  • sh.owais95/wine
  • yaoyuan.0553/wine
  • AnthonyLaurienti/wine
  • mivanchev/wine
  • Hi-Angel/wine
  • vt/wine
  • wyrquill/wine
  • waynus/wine
  • wuliande/wine
  • yao.yuan.wn/wine
  • K1K1/wine
  • lukehutch1027/wine
  • etang-cw/wine
  • Josueblanco/wine
  • jplotz/wine
  • j20001970/wine
  • jsm174/wine
  • aricstewart/wine
  • uncoveryoureyestheresnosun/wine
  • VitorRamos/wine
  • 0e4ef622/wine
  • tj4048750/wine
  • xantares/wine
  • maxfigura/wine
  • sanane/wine
  • juniorjr9345/wine
  • lucaspereira1234/wine
  • gerald/wine
  • lepemiguel32/wine
  • caibb2018/wine
  • CNB_Kevin/wine
  • thc13/wine
  • jaihysc/wine
  • youngsecurity/wine
  • chendeqiang1024/wine
  • rhendric/wine
  • databoose/wine
  • memory-thrasher/wine
  • salman.tajik22/wine
  • CowFroggers/wine
  • kbdharun/wine
  • dreamer/wine
  • babyjoey711/wine
  • ripxorip/wine
  • PSzczepanski1996/wine
  • steveshe006/wine
  • joshua/wine
  • cmccarthy/wine
  • tomjansen/wine
  • sonyps5201314/wine
  • katelynnking4281/wine
  • dhary686/wine
  • mathematician/wine
  • rhabacker/wine
  • steveschnepp/wine
  • nekotekina/wine
  • Aaron1011/wine
  • catsout/wine
  • kasper93/wine
  • beef331/wine
  • ESD/wine
  • sarosib/wine
  • ghurmcardash/wine
  • AMZN-hgoffin/wine
  • gtmikw/wine
  • Keming/wine
  • dpjh747-gl/wine
  • tzluo/wine
  • rfz/wine
  • illia.a.polishchuk/wine
  • new_kleth/wine
  • serkan-maker/wine
  • w-flo/wine
  • mikayahlevi/wine
  • nulleve/wine
  • pgruebele/wine
  • athiele/wine
  • paparaha4/wine
  • novenary/wine
  • Plavil/wine
  • longjunyu/wine
  • chrisli/wine
  • samkottler/wine
  • danielzgtg/wine
  • twcassel/wine
  • guo/wine
  • didier31/wine
  • Zhaoyi/wine
  • twhitehead/wine
  • svyatpro/wine
  • infyquest/wine-iq-devel
  • sebres/wine
  • endrift/wine
  • zhengbl/wine
  • joelikeyan/wine
  • IsaacMarovitz/wine
  • LouiseTheGoldenGoddess/wine
  • SergeGautherie/wine
  • Klittiklatsch/wine
  • ldhacker/wine
  • dk1006498/wine
  • ishitatsuyuki/wine
  • h3c/wine
  • wincenty.bandyta41/wine
  • ayhankus482/wine
  • q4a/wine
  • mjgarton/wine
  • agusev/wine
  • vovams/wine
  • shardulsb08/wine
  • lylythechosenone/wine
  • artemist/wine
  • dropbear/wine
  • Cherser-s/wine
  • smayr/wine
  • loveptong/wine
  • chendeqiang/wine
  • gaber139/wine
  • shytzedaka/wine
  • ghkmufc/wine
  • TornadoCookie/wine
  • klownwolfman/wine
  • bylaws/wine
  • vitorhnn/wine
  • mide1337/wine
  • mewinkler/wine
  • firelzrd/wine
  • Samsuper/wine
  • kkartaltepe/wine
  • petravion/wine
  • Maaka00524/jacob-wine
  • petrathekat/wine
  • dj/wine
  • liam-middlebrook/wine
  • padolkarlucky/wine
  • maarten/wine
  • yhd986/wine
  • linkmecry/wine
  • tehrantoday/wine
  • xuxin12345/wine
  • dmjc/wine
  • sedwards/wine
  • hanslehnert/wine
  • 3ts75/wine
  • EkaterinePapava/wine
  • lav/wine
  • lygstate/wine
  • mxkrsv/wine
  • xutaxkamay/wine
  • cbialorucki/wine
  • yshui/wine
  • baikaishiuc/wine
  • HuwCampbell/wine
  • llde/wine
  • rockdrilla/wine
  • aidanhs/wine
  • SwimmingTiger/wine
  • fvalasiad/wine
  • zsoltiv/wine
  • mailnew4ster/wine
  • ake.rehnman/wine
  • IDocin/wine
  • dmitry/wine
  • Cthuflu/wine
  • corngood/wine
  • whindsaks/wine
  • telans/wine
  • DmitrySokolov/wine
  • Pospelove/wine
  • ellingtonsantos/wine
  • roro/wine
  • wurenny/wine
  • KokoseiJ/wine
  • amurzeau/wine
  • spazzymoto/wine
  • searchingin/wine
  • marler8997/wine
  • Alcaro/wine
  • aunali1/wine
  • snaccslocc420/wine
  • ajkhoury/wine
  • qsniyg/wine
  • Matheus-TestUser1/wine
  • adamrehn/wine
  • brobston/wine
  • aalyaev/wine
  • thongthai/wine
  • j.bayer1988/wine
  • skitt/wine
  • benben/wine
  • ahmouse15/wine
  • achurch/wine
  • mfaqiri2/wine
  • yseo/wine
  • kingjinni/wine
  • userid0x0/wine
  • titan/wine
  • Komoszek/wine
  • GamzeeRakoon/wine
  • joanluc/wine
  • Alan/wine
  • meshine/wine
  • EBADF/wine
  • vibhavp/wine
  • quininer/wine
  • pawelulita/wine
  • muek2211/wine
  • chenhaoyang/wine
  • nishiyama/wine
  • silviuxgaming/wine
  • nell/wine
  • 29jm/wine
  • arilou/wine
  • Mini-Gaunt/wine
  • DodoGTA/wine
  • davispuh/wine
  • mzent/wine
  • arakmar/wine
  • number201724/wine
  • yhd986/wine-up
  • rpisl/wine
  • zp1/wine-zp-cs-464
  • h0tc0d3/wine
  • Snowiiii/wine
  • gabrielb/wine
  • PureBulb/wine
  • OO/wine
  • Clara/wine
  • Saancreed/wine
  • enolp/wine
  • arthunix/wine
  • halfline/wine
  • carlo-bramini/wine
  • jfmu/wine
  • russelltg/wine
  • ntay/wine
  • YellowOnion/wine
  • niversesu/wine
  • gilvbp/wine
  • tingling0072/wine
  • DandD1517/wine
  • rastos/add-GetAnycastIpAddressTable
  • gnif/wine
  • gibsonpil/wine
  • antenabr2/wine
  • kvashis/wine
  • CKolle/wine
  • kubni/wine
  • ten0s/wine
  • Yvonne8873/wine
  • kurikaesu/wine
  • minggr/wine
  • JohnSebastienNadeau/wine
  • karshnicholas/wine
  • SamB/wine
  • apgrc/wine
  • Samiklom/wine
  • llyyr/wine
  • nberner/wine
  • katharinechui/wine
  • kirill.zhumarin/wine
  • vaxerski/wine
  • infiniteloop/wine
  • K0bin/wine
  • arethusa/wine
  • mrdeathjr28/wine
  • dank_meme/wine
  • dh/wine
  • tuomasjjrasanen/wine
  • mmcdonnell/wine
  • mxnny00/wine-manjaro-arch-compatibility
  • Joan/wine
  • g.mo.alcauter/wine
  • zhenbo_li/wine
  • tsmx/wine
  • xaqumin/wine
  • peterjc123/wine
  • ruslangaripov/wine
  • blyss/wine
  • xanathar/wine
  • michael.bond/wine
  • Quix0r/wine
  • sinisa.susnjar/wine
  • Rapid/wine
  • theli.ua/wine
  • shaun.din/wine
  • zhaohongxin/wine
  • dylan.eskew/wine
  • humbertoperezs991/wine
  • vaevi/wine
  • Riesi/wine
  • francisdb/wine
  • 1480c1/wine
  • trcrsired/wine
  • npatt/wine
  • muhammmadalli/wine9.0
  • Czahrien/wine
  • nilsen.jonas/wine
  • underdogest/wine
  • djordjem/wine
  • frubin/wine
  • LucasChollet/wine
  • lipengfei-loongson/wine
  • JacobCzekalla/wine-fork-jacob
  • omar_elantil/wine
  • lumarel/wine
  • principeagustin/wine
  • gotzl/wine
  • OneTester250376/wine
  • austin987/wine
  • unknown62627/wine
  • navi/wine
  • somedevfox/wine
  • notaz/wine
  • fcasas/wine
  • Asteroz/wine
  • MariusSchiffer/wine
  • kevinrmartinez/wine-devel
  • St1gven/wine
  • maarten256/wine
  • rcstarr87/wine
  • tinozzo123/wine
  • GermanAizek/wine
  • spencerwallace/wine
  • schloegl/wine
  • giuppococco/wine
  • shayan7878/wine
  • N080DY12/wine
  • ralf.habacker/wine
  • oh-ok/wine
  • johnporter/wine
  • Low-power/wine
  • thelande/wine
  • riyu12383/wine
  • kubapet/wine
  • Ivan_83/wine
  • SmithGoll/wine
  • gmesmer/wine
  • akarisu.de/wine
  • jwffrey9046/wine
  • anders/wine
  • markbhasawut/wine
  • dy-tea/wine
  • Benjamin_Loison/wine
  • frmdstryr/wine
  • zzam/wine
  • haydenhestad/wine
  • Deppy04/wine
  • osbre/wine
  • CharlottePabst/wine
  • SunlitTango/wine
  • ritalat/wine
  • AlexeyLushnikov/wine
  • mickdermack/wine
  • s1UMBa/wine
  • huangqinjin/wine
  • caseyr297/wine
  • d1saster/wine
  • ayufdh222/wine
  • janstrakowski/wine
  • petur/wine
  • matheus.venturini/wine-fix-ohm-sign
  • rayrapetyan/wine
  • xiaotong/wine
  • ovarley1/wine
  • dos1/wine
  • BZZZZ/wine
  • joesoroka/wine
  • toadking/wine
  • JoshuaBrest/wine
  • elias/wine
  • michele.dionisio/wine
  • garlett/wine-send-arp
  • eugenemcardle/wine
  • hugwijst/wine
  • whrvt/wine
  • loisgomez/wine
  • ramleejo/wine
  • self/wine
  • fr33z00/wine
  • JoeS209/wine
  • JacKeTUs/wine
  • nak.ak2015/wine
  • morgwai/wine
  • funfunctor/wine
  • donnyjoe/wine
  • sitter/wine
  • atticf/wine
  • xipster/wine
  • sebastian/wine
  • AlexanderWillner/wine
  • yaoyongjie/wine
  • wayne/wine
  • AMark/wine
  • zamaudio/wine
  • TomaszPakula/wine
  • Freakness109/wine
  • amorozov/wine
  • HP/wine
  • danlm/wine
  • rariema/wine
  • Biswa96/wine
  • rlippmann/wine
  • yangkun/wine
  • greyghoster/wine
  • toxieainc/wine
520 results
Show changes
/* WinRT Windows.Management.Deployment.PackageManager Implementation
*
* Copyright (C) 2023 Mohamad Al-Jaf
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(appx);
struct package_manager
{
IPackageManager IPackageManager_iface;
IPackageManager2 IPackageManager2_iface;
LONG ref;
};
static inline struct package_manager *impl_from_IPackageManager( IPackageManager *iface )
{
return CONTAINING_RECORD( iface, struct package_manager, IPackageManager_iface );
}
static HRESULT WINAPI package_manager_QueryInterface( IPackageManager *iface, REFIID iid, void **out )
{
struct package_manager *impl = impl_from_IPackageManager( iface );
TRACE( "iface %p, iid %s, out %p.\n", iface, debugstr_guid( iid ), out );
if (IsEqualGUID( iid, &IID_IUnknown ) ||
IsEqualGUID( iid, &IID_IInspectable ) ||
IsEqualGUID( iid, &IID_IAgileObject ) ||
IsEqualGUID( iid, &IID_IPackageManager ))
{
*out = &impl->IPackageManager_iface;
IInspectable_AddRef( *out );
return S_OK;
}
if (IsEqualGUID( iid, &IID_IPackageManager2 ))
{
*out = &impl->IPackageManager2_iface;
IInspectable_AddRef( *out );
return S_OK;
}
FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) );
*out = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI package_manager_AddRef( IPackageManager *iface )
{
struct package_manager *impl = impl_from_IPackageManager( iface );
ULONG ref = InterlockedIncrement( &impl->ref );
TRACE( "iface %p increasing refcount to %lu.\n", iface, ref );
return ref;
}
static ULONG WINAPI package_manager_Release( IPackageManager *iface )
{
struct package_manager *impl = impl_from_IPackageManager( iface );
ULONG ref = InterlockedDecrement( &impl->ref );
TRACE( "iface %p decreasing refcount to %lu.\n", iface, ref );
if (!ref) free( impl );
return ref;
}
static HRESULT WINAPI package_manager_GetIids( IPackageManager *iface, ULONG *iid_count, IID **iids )
{
FIXME( "iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager_GetRuntimeClassName( IPackageManager *iface, HSTRING *class_name )
{
FIXME( "iface %p, class_name %p stub!\n", iface, class_name );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager_GetTrustLevel( IPackageManager *iface, TrustLevel *trust_level )
{
FIXME( "iface %p, trust_level %p stub!\n", iface, trust_level );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager_AddPackageAsync( IPackageManager *iface, IUriRuntimeClass *uri,
IIterable_Uri *dependencies, DeploymentOptions options, IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation )
{
FIXME( "iface %p, uri %p, dependencies %p, options %d, operation %p stub!\n", iface, uri, dependencies, options, operation );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager_UpdatePackageAsync( IPackageManager *iface, IUriRuntimeClass *uri, IIterable_Uri *dependencies,
DeploymentOptions options, IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation )
{
FIXME( "iface %p, uri %p, dependencies %p, options %d, operation %p stub!\n", iface, uri, dependencies, options, operation );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager_RemovePackageAsync( IPackageManager *iface, HSTRING name,
IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation )
{
FIXME( "iface %p, name %s, operation %p stub!\n", iface, debugstr_hstring(name), operation );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager_StagePackageAsync( IPackageManager *iface, IUriRuntimeClass *uri, IIterable_Uri *dependencies,
IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation )
{
FIXME( "iface %p, uri %p, dependencies %p, operation %p stub!\n", iface, uri, dependencies, operation );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager_RegisterPackageAsync( IPackageManager *iface, IUriRuntimeClass *uri, IIterable_Uri *dependencies,
DeploymentOptions options, IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation )
{
FIXME( "iface %p, uri %p, dependencies %p, options %d, operation %p stub!\n", iface, uri, dependencies, options, operation );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager_FindPackages( IPackageManager *iface, IIterable_Package **packages )
{
FIXME( "iface %p, packages %p stub!\n", iface, packages );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager_FindPackagesByUserSecurityId( IPackageManager *iface, HSTRING sid, IIterable_Package **packages )
{
FIXME( "iface %p, sid %s, packages %p stub!\n", iface, debugstr_hstring(sid), packages );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager_FindPackagesByNamePublisher( IPackageManager *iface, HSTRING name, HSTRING publisher, IIterable_Package **packages )
{
FIXME( "iface %p, name %s, publisher %s, packages %p stub!\n", iface, debugstr_hstring(name), debugstr_hstring(publisher), packages );
if (!name || !publisher) return E_INVALIDARG;
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager_FindPackagesByUserSecurityIdNamePublisher( IPackageManager *iface, HSTRING sid,
HSTRING name, HSTRING publisher, IIterable_Package **packages )
{
FIXME( "iface %p, sid %s, name %s, publisher %s, packages %p stub!\n", iface, debugstr_hstring(sid), debugstr_hstring(name), debugstr_hstring(publisher), packages );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager_FindUsers( IPackageManager *iface, HSTRING name, IIterable_PackageUserInformation **users )
{
FIXME( "iface %p, name %s, users %p stub!\n", iface, debugstr_hstring(name), users );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager_SetPackageState( IPackageManager *iface, HSTRING name, PackageState state )
{
FIXME("iface %p, name %s, state %d stub!\n", iface, debugstr_hstring(name), state);
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager_FindPackageByPackageFullName( IPackageManager *iface, HSTRING name, IPackage **package )
{
FIXME( "iface %p, name %s, package %p stub!\n", iface, debugstr_hstring(name), package );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager_CleanupPackageForUserAsync( IPackageManager *iface, HSTRING name, HSTRING sid,
IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation )
{
FIXME( "iface %p, name %s, sid %s, operation %p stub!\n", iface, debugstr_hstring(name), debugstr_hstring(sid), operation );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager_FindPackagesByPackageFamilyName( IPackageManager *iface, HSTRING family_name,
IIterable_Package **packages )
{
FIXME( "iface %p, family_name %s, packages %p stub!\n", iface, debugstr_hstring(family_name), packages );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager_FindPackagesByUserSecurityIdPackageFamilyName( IPackageManager *iface, HSTRING sid,
HSTRING family_name, IIterable_Package **packages )
{
FIXME( "iface %p, sid %s, family_name %s, packages %p stub!\n", iface, debugstr_hstring(sid), debugstr_hstring(family_name), packages );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager_FindPackageByUserSecurityIdPackageFullName( IPackageManager *iface, HSTRING sid, HSTRING name, IPackage **package )
{
FIXME( "iface %p, sid %s, name %s, package %p stub!\n", iface, debugstr_hstring(sid), debugstr_hstring(name), package );
return E_NOTIMPL;
}
static const struct IPackageManagerVtbl package_manager_vtbl =
{
package_manager_QueryInterface,
package_manager_AddRef,
package_manager_Release,
/* IInspectable methods */
package_manager_GetIids,
package_manager_GetRuntimeClassName,
package_manager_GetTrustLevel,
/* IPackageManager methods */
package_manager_AddPackageAsync,
package_manager_UpdatePackageAsync,
package_manager_RemovePackageAsync,
package_manager_StagePackageAsync,
package_manager_RegisterPackageAsync,
package_manager_FindPackages,
package_manager_FindPackagesByUserSecurityId,
package_manager_FindPackagesByNamePublisher,
package_manager_FindPackagesByUserSecurityIdNamePublisher,
package_manager_FindUsers,
package_manager_SetPackageState,
package_manager_FindPackageByPackageFullName,
package_manager_CleanupPackageForUserAsync,
package_manager_FindPackagesByPackageFamilyName,
package_manager_FindPackagesByUserSecurityIdPackageFamilyName,
package_manager_FindPackageByUserSecurityIdPackageFullName
};
DEFINE_IINSPECTABLE( package_manager2, IPackageManager2, struct package_manager, IPackageManager_iface );
static HRESULT WINAPI package_manager2_RemovePackageWithOptionsAsync( IPackageManager2 *iface, HSTRING name, RemovalOptions options,
IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation )
{
FIXME( "iface %p, name %s, options %d, operation %p stub!\n", iface, debugstr_hstring(name), options, operation );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager2_StagePackageWithOptionsAsync( IPackageManager2 *iface, IUriRuntimeClass *uri, IIterable_Uri *dependencies,
DeploymentOptions options, IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation )
{
FIXME( "iface %p, uri %p, dependencies %p, options %d, operation %p stub!\n", iface, uri, dependencies, options, operation );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager2_RegisterPackageByFullNameAsync( IPackageManager2 *iface, HSTRING name, IIterable_HSTRING *dependencies,
DeploymentOptions options, IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation )
{
FIXME( "iface %p, name %s, dependencies %p, options %d, operation %p stub!\n", iface, debugstr_hstring(name), dependencies, options, operation );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager2_FindPackagesWithPackageTypes( IPackageManager2 *iface, PackageTypes types, IIterable_Package **packages )
{
FIXME( "iface %p, types %d, packages %p stub!\n", iface, types, packages );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager2_FindPackagesByUserSecurityIdWithPackageTypes( IPackageManager2 *iface, HSTRING sid,
PackageTypes types, IIterable_Package **packages )
{
FIXME( "iface %p, sid %s, types %d, packages %p stub!\n", iface, debugstr_hstring(sid), types, packages );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager2_FindPackagesByNamePublisherWithPackageTypes( IPackageManager2 *iface, HSTRING name, HSTRING publisher,
PackageTypes types, IIterable_Package **packages )
{
FIXME( "iface %p, name %s, publisher %s, types %d, packages %p stub!\n", iface, debugstr_hstring(name), debugstr_hstring(publisher), types, packages );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager2_FindPackagesByUserSecurityIdNamePublisherWithPackageTypes( IPackageManager2 *iface, HSTRING sid, HSTRING name,
HSTRING publisher, PackageTypes types, IIterable_Package **packages )
{
FIXME( "iface %p, sid %s, name %s, publisher %s, types %d, packages %p stub!\n", iface, debugstr_hstring(sid), debugstr_hstring(name), debugstr_hstring(publisher), types, packages );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager2_FindPackagesByPackageFamilyNameWithPackageTypes( IPackageManager2 *iface, HSTRING family_name, PackageTypes types,
IIterable_Package **packages )
{
FIXME( "iface %p, family_name %s, types %d, packages %p stub!\n", iface, debugstr_hstring(family_name), types, packages );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager2_FindPackagesByUserSecurityIdPackageFamilyNameWithPackageTypes( IPackageManager2 *iface, HSTRING sid, HSTRING family_name,
PackageTypes types, IIterable_Package **packages )
{
FIXME( "iface %p, sid %s, family_name %s, types %d, packages %p stub!\n", iface, debugstr_hstring(sid), debugstr_hstring(family_name), types, packages );
return E_NOTIMPL;
}
static HRESULT WINAPI package_manager2_StageUserDataAsync( IPackageManager2 *iface, HSTRING name,
IAsyncOperationWithProgress_DeploymentResult_DeploymentProgress **operation )
{
FIXME( "iface %p, name %s, operation %p stub!\n", iface, debugstr_hstring(name), operation );
return E_NOTIMPL;
}
static const struct IPackageManager2Vtbl package_manager2_vtbl =
{
package_manager2_QueryInterface,
package_manager2_AddRef,
package_manager2_Release,
/* IInspectable methods */
package_manager2_GetIids,
package_manager2_GetRuntimeClassName,
package_manager2_GetTrustLevel,
/* IPackageManager2 methods */
package_manager2_RemovePackageWithOptionsAsync,
package_manager2_StagePackageWithOptionsAsync,
package_manager2_RegisterPackageByFullNameAsync,
package_manager2_FindPackagesWithPackageTypes,
package_manager2_FindPackagesByUserSecurityIdWithPackageTypes,
package_manager2_FindPackagesByNamePublisherWithPackageTypes,
package_manager2_FindPackagesByUserSecurityIdNamePublisherWithPackageTypes,
package_manager2_FindPackagesByPackageFamilyNameWithPackageTypes,
package_manager2_FindPackagesByUserSecurityIdPackageFamilyNameWithPackageTypes,
package_manager2_StageUserDataAsync,
};
struct package_manager_statics
{
IActivationFactory IActivationFactory_iface;
LONG ref;
};
static inline struct package_manager_statics *impl_from_IActivationFactory( IActivationFactory *iface )
{
return CONTAINING_RECORD( iface, struct package_manager_statics, IActivationFactory_iface );
}
static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID iid, void **out )
{
struct package_manager_statics *impl = impl_from_IActivationFactory( iface );
TRACE( "iface %p, iid %s, out %p.\n", iface, debugstr_guid( iid ), out );
if (IsEqualGUID( iid, &IID_IUnknown ) ||
IsEqualGUID( iid, &IID_IInspectable ) ||
IsEqualGUID( iid, &IID_IActivationFactory ))
{
*out = &impl->IActivationFactory_iface;
IInspectable_AddRef( *out );
return S_OK;
}
FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) );
*out = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI factory_AddRef( IActivationFactory *iface )
{
struct package_manager_statics *impl = impl_from_IActivationFactory( iface );
ULONG ref = InterlockedIncrement( &impl->ref );
TRACE( "iface %p increasing refcount to %lu.\n", iface, ref );
return ref;
}
static ULONG WINAPI factory_Release( IActivationFactory *iface )
{
struct package_manager_statics *impl = impl_from_IActivationFactory( iface );
ULONG ref = InterlockedDecrement( &impl->ref );
TRACE( "iface %p decreasing refcount to %lu.\n", iface, ref );
return ref;
}
static HRESULT WINAPI factory_GetIids( IActivationFactory *iface, ULONG *iid_count, IID **iids )
{
FIXME( "iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids );
return E_NOTIMPL;
}
static HRESULT WINAPI factory_GetRuntimeClassName( IActivationFactory *iface, HSTRING *class_name )
{
FIXME( "iface %p, class_name %p stub!\n", iface, class_name );
return E_NOTIMPL;
}
static HRESULT WINAPI factory_GetTrustLevel( IActivationFactory *iface, TrustLevel *trust_level )
{
FIXME( "iface %p, trust_level %p stub!\n", iface, trust_level );
return E_NOTIMPL;
}
static HRESULT WINAPI factory_ActivateInstance( IActivationFactory *iface, IInspectable **instance )
{
struct package_manager *impl;
TRACE( "iface %p, instance %p.\n", iface, instance );
if (!(impl = calloc( 1, sizeof(*impl) )))
{
*instance = NULL;
return E_OUTOFMEMORY;
}
impl->IPackageManager_iface.lpVtbl = &package_manager_vtbl;
impl->IPackageManager2_iface.lpVtbl = &package_manager2_vtbl;
impl->ref = 1;
*instance = (IInspectable *)&impl->IPackageManager_iface;
return S_OK;
}
static const struct IActivationFactoryVtbl factory_vtbl =
{
factory_QueryInterface,
factory_AddRef,
factory_Release,
/* IInspectable methods */
factory_GetIids,
factory_GetRuntimeClassName,
factory_GetTrustLevel,
/* IActivationFactory methods */
factory_ActivateInstance,
};
static struct package_manager_statics package_manager_statics =
{
{&factory_vtbl},
1,
};
IActivationFactory *package_manager_factory = &package_manager_statics.IActivationFactory_iface;
/* WinRT Windows.Management.Deployment Implementation
*
* Copyright (C) 2023 Mohamad Al-Jaf
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_WINDOWS_MANAGEMENT_DEPLOYMENT_PRIVATE_H
#define __WINE_WINDOWS_MANAGEMENT_DEPLOYMENT_PRIVATE_H
#include <stdarg.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winstring.h"
#include "activation.h"
#define WIDL_using_Windows_Foundation
#define WIDL_using_Windows_Foundation_Collections
#include "windows.foundation.h"
#define WIDL_using_Windows_Management_Deployment
#define WIDL_using_Windows_ApplicationModel
#include "windows.management.deployment.h"
extern IActivationFactory *package_manager_factory;
#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \
static inline impl_type *impl_from( iface_type *iface ) \
{ \
return CONTAINING_RECORD( iface, impl_type, iface_mem ); \
} \
static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \
{ \
impl_type *impl = impl_from( iface ); \
return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \
} \
static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \
{ \
impl_type *impl = impl_from( iface ); \
return IInspectable_AddRef( (IInspectable *)(expr) ); \
} \
static ULONG WINAPI pfx##_Release( iface_type *iface ) \
{ \
impl_type *impl = impl_from( iface ); \
return IInspectable_Release( (IInspectable *)(expr) ); \
} \
static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \
{ \
impl_type *impl = impl_from( iface ); \
return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \
} \
static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \
{ \
impl_type *impl = impl_from( iface ); \
return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \
} \
static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \
{ \
impl_type *impl = impl_from( iface ); \
return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \
}
#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \
DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface )
#endif
......@@ -3,12 +3,10 @@ IMPORTLIB = atl
IMPORTS = uuid oleaut32 ole32 user32 gdi32 advapi32 shlwapi
EXTRADEFS = -D_ATL_VER=_ATL_VER_30
C_SRCS = \
SOURCES = \
atl.c \
atl30.c \
atl_ax.c \
registrar.c
IDL_SRCS = \
atl_classes.idl \
atl_lib.idl
atl_lib.idl \
registrar.c
......@@ -23,26 +23,13 @@
#include "atlcom.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(atl);
#define ATLVer1Size FIELD_OFFSET(_ATL_MODULEW, dwAtlBuildVer)
HINSTANCE atl_instance;
typedef unsigned char cpp_bool;
static inline void *heap_alloc(size_t len)
{
return HeapAlloc(GetProcessHeap(), 0, len);
}
static inline BOOL heap_free(void *mem)
{
return HeapFree(GetProcessHeap(), 0, mem);
}
static ICatRegister *catreg;
/***********************************************************************
......@@ -82,7 +69,7 @@ HRESULT WINAPI AtlUnadvise(IUnknown *pUnkCP, const IID *iid, DWORD dw)
IConnectionPoint *cp;
HRESULT hres;
TRACE("%p %p %d\n", pUnkCP, iid, dw);
TRACE("%p %p %ld\n", pUnkCP, iid, dw);
if(!pUnkCP)
return E_INVALIDARG;
......@@ -133,7 +120,6 @@ HRESULT WINAPI AtlUnmarshalPtr(IStream *stm, const IID *iid, IUnknown **ppUnk)
*/
HDC WINAPI AtlCreateTargetDC( HDC hdc, DVTARGETDEVICE *dv )
{
static const WCHAR displayW[] = {'d','i','s','p','l','a','y',0};
const WCHAR *driver = NULL, *device = NULL, *port = NULL;
DEVMODEW *devmode = NULL;
......@@ -149,7 +135,7 @@ HDC WINAPI AtlCreateTargetDC( HDC hdc, DVTARGETDEVICE *dv )
else
{
if (hdc) return hdc;
driver = displayW;
driver = L"display";
}
return CreateDCW( driver, device, port, devmode );
}
......@@ -223,7 +209,7 @@ HRESULT WINAPI AtlInternalQueryInterface(void* this, const _ATL_INTMAP_ENTRY* pE
while (pEntries[i].pFunc != 0)
{
TRACE("Trying entry %i (%s %i %p)\n",i,debugstr_guid(pEntries[i].piid),
TRACE("Trying entry %i (%s %Ix %p)\n",i,debugstr_guid(pEntries[i].piid),
pEntries[i].dw, pEntries[i].pFunc);
if (!pEntries[i].piid || IsEqualGUID(iid,pEntries[i].piid))
......@@ -246,7 +232,7 @@ HRESULT WINAPI AtlInternalQueryInterface(void* this, const _ATL_INTMAP_ENTRY* pE
}
i++;
}
TRACE("Done returning (0x%x)\n",rc);
TRACE("Done returning (0x%lx)\n",rc);
return rc;
}
......@@ -304,10 +290,10 @@ HRESULT WINAPI AtlModuleAddTermFunc(_ATL_MODULE *pM, _ATL_TERMFUNC *pFunc, DWORD
{
_ATL_TERMFUNC_ELEM *termfunc_elem;
TRACE("version %04x (%p %p %ld)\n", _ATL_VER, pM, pFunc, dw);
TRACE("version %04x (%p %p %Id)\n", _ATL_VER, pM, pFunc, dw);
if (_ATL_VER > _ATL_VER_30 || pM->cbSize > ATLVer1Size) {
termfunc_elem = HeapAlloc(GetProcessHeap(), 0, sizeof(_ATL_TERMFUNC_ELEM));
termfunc_elem = malloc(sizeof(*termfunc_elem));
termfunc_elem->pFunc = pFunc;
termfunc_elem->dw = dw;
termfunc_elem->pNext = pM->m_pTermFuncs;
......@@ -333,7 +319,7 @@ void WINAPI AtlCallTermFunc(_ATL_MODULE *pM)
iter->pFunc(iter->dw);
tmp = iter;
iter = iter->pNext;
HeapFree(GetProcessHeap(), 0, tmp);
free(tmp);
}
pM->m_pTermFuncs = NULL;
......@@ -352,18 +338,16 @@ HRESULT WINAPI AtlLoadTypeLib(HINSTANCE inst, LPCOLESTR lpszIndex,
WCHAR *path;
HRESULT hres;
static const WCHAR tlb_extW[] = {'.','t','l','b',0};
TRACE("(%p %s %p %p)\n", inst, debugstr_w(lpszIndex), pbstrPath, ppTypeLib);
index_len = lpszIndex ? strlenW(lpszIndex) : 0;
path = heap_alloc((MAX_PATH+index_len)*sizeof(WCHAR) + sizeof(tlb_extW));
index_len = lpszIndex ? lstrlenW(lpszIndex) : 0;
path = malloc((MAX_PATH+index_len)*sizeof(WCHAR) + sizeof(L".tlb"));
if(!path)
return E_OUTOFMEMORY;
path_len = GetModuleFileNameW(inst, path, MAX_PATH);
if(!path_len) {
heap_free(path);
free(path);
return HRESULT_FROM_WIN32(GetLastError());
}
......@@ -377,7 +361,7 @@ HRESULT WINAPI AtlLoadTypeLib(HINSTANCE inst, LPCOLESTR lpszIndex,
for(ptr = path+path_len-1; ptr > path && *ptr != '\\' && *ptr != '.'; ptr--);
if(*ptr != '.')
ptr = path+path_len;
memcpy(ptr, tlb_extW, sizeof(tlb_extW));
lstrcpyW(ptr, L".tlb");
hres = LoadTypeLib(path, &typelib);
}
......@@ -389,7 +373,7 @@ HRESULT WINAPI AtlLoadTypeLib(HINSTANCE inst, LPCOLESTR lpszIndex,
}
}
heap_free(path);
free(path);
if(FAILED(hres))
return hres;
......@@ -486,6 +470,7 @@ void* WINAPI AtlWinModuleExtractCreateWndData(_ATL_WIN_MODULE *winmod)
/***********************************************************************
* AtlComModuleGetClassObject [atl100.15]
*/
#if _ATL_VER < _ATL_VER_110
HRESULT WINAPI AtlComModuleGetClassObject(_ATL_COM_MODULE *pm, REFCLSID rclsid, REFIID riid, void **ppv)
{
_ATL_OBJMAP_ENTRY **iter;
......@@ -497,12 +482,37 @@ HRESULT WINAPI AtlComModuleGetClassObject(_ATL_COM_MODULE *pm, REFCLSID rclsid,
return E_INVALIDARG;
for(iter = pm->m_ppAutoObjMapFirst; iter < pm->m_ppAutoObjMapLast; iter++) {
if(IsEqualCLSID((*iter)->pclsid, rclsid) && (*iter)->pfnGetClassObject) {
if(*iter && IsEqualCLSID((*iter)->pclsid, rclsid) && (*iter)->pfnGetClassObject) {
if(!(*iter)->pCF)
hres = (*iter)->pfnGetClassObject((*iter)->pfnCreateInstance, &IID_IUnknown, (void**)&(*iter)->pCF);
if((*iter)->pCF)
hres = IUnknown_QueryInterface((*iter)->pCF, riid, ppv);
TRACE("returning %p (%08x)\n", *ppv, hres);
TRACE("returning %p (%08lx)\n", *ppv, hres);
return hres;
}
}
WARN("Class %s not found\n", debugstr_guid(rclsid));
return CLASS_E_CLASSNOTAVAILABLE;
}
#else
HRESULT WINAPI AtlComModuleGetClassObject(_ATL_COM_MODULE *pm, REFCLSID rclsid, REFIID riid, void **ppv)
{
_ATL_OBJMAP_ENTRY_EX **iter;
HRESULT hres;
TRACE("(%p %s %s %p)\n", pm, debugstr_guid(rclsid), debugstr_guid(riid), ppv);
if(!pm)
return E_INVALIDARG;
for(iter = pm->m_ppAutoObjMapFirst; iter < pm->m_ppAutoObjMapLast; iter++) {
if(*iter && IsEqualCLSID((*iter)->pclsid, rclsid) && (*iter)->pfnGetClassObject) {
if(!(*iter)->pCache->pCF)
hres = (*iter)->pfnGetClassObject((*iter)->pfnCreateInstance, &IID_IUnknown, (void**)&(*iter)->pCache->pCF);
if((*iter)->pCache->pCF)
hres = IUnknown_QueryInterface((*iter)->pCache->pCF, riid, ppv);
TRACE("returning %p (%08lx)\n", *ppv, hres);
return hres;
}
}
......@@ -510,23 +520,25 @@ HRESULT WINAPI AtlComModuleGetClassObject(_ATL_COM_MODULE *pm, REFCLSID rclsid,
WARN("Class %s not found\n", debugstr_guid(rclsid));
return CLASS_E_CLASSNOTAVAILABLE;
}
#endif
/***********************************************************************
* AtlComModuleRegisterClassObjects [atl100.17]
*/
#if _ATL_VER < _ATL_VER_110
HRESULT WINAPI AtlComModuleRegisterClassObjects(_ATL_COM_MODULE *module, DWORD context, DWORD flags)
{
_ATL_OBJMAP_ENTRY **iter;
IUnknown *unk;
HRESULT hres;
TRACE("(%p %x %x)\n", module, context, flags);
TRACE("(%p %lx %lx)\n", module, context, flags);
if(!module)
return E_INVALIDARG;
for(iter = module->m_ppAutoObjMapFirst; iter < module->m_ppAutoObjMapLast; iter++) {
if(!(*iter)->pfnGetClassObject)
if(!(*iter) || !(*iter)->pfnGetClassObject)
continue;
hres = (*iter)->pfnGetClassObject((*iter)->pfnCreateInstance, &IID_IUnknown, (void**)&unk);
......@@ -541,10 +553,40 @@ HRESULT WINAPI AtlComModuleRegisterClassObjects(_ATL_COM_MODULE *module, DWORD c
return S_OK;
}
#else
HRESULT WINAPI AtlComModuleRegisterClassObjects(_ATL_COM_MODULE *module, DWORD context, DWORD flags)
{
_ATL_OBJMAP_ENTRY_EX **iter;
IUnknown *unk;
HRESULT hres;
TRACE("(%p %lx %lx)\n", module, context, flags);
if(!module)
return E_INVALIDARG;
for(iter = module->m_ppAutoObjMapFirst; iter < module->m_ppAutoObjMapLast; iter++) {
if(!(*iter) || !(*iter)->pfnGetClassObject)
continue;
hres = (*iter)->pfnGetClassObject((*iter)->pfnCreateInstance, &IID_IUnknown, (void**)&unk);
if(FAILED(hres))
return hres;
hres = CoRegisterClassObject((*iter)->pclsid, unk, context, flags, &(*iter)->pCache->dwRegister);
IUnknown_Release(unk);
if(FAILED(hres))
return hres;
}
return S_OK;
}
#endif
/***********************************************************************
* AtlComModuleRevokeClassObjects [atl100.20]
*/
#if _ATL_VER < _ATL_VER_110
HRESULT WINAPI AtlComModuleRevokeClassObjects(_ATL_COM_MODULE *module)
{
_ATL_OBJMAP_ENTRY **iter;
......@@ -556,6 +598,9 @@ HRESULT WINAPI AtlComModuleRevokeClassObjects(_ATL_COM_MODULE *module)
return E_INVALIDARG;
for(iter = module->m_ppAutoObjMapFirst; iter < module->m_ppAutoObjMapLast; iter++) {
if(!(*iter))
continue;
hres = CoRevokeClassObject((*iter)->dwRegister);
if(FAILED(hres))
return hres;
......@@ -563,10 +608,34 @@ HRESULT WINAPI AtlComModuleRevokeClassObjects(_ATL_COM_MODULE *module)
return S_OK;
}
#else
HRESULT WINAPI AtlComModuleRevokeClassObjects(_ATL_COM_MODULE *module)
{
_ATL_OBJMAP_ENTRY_EX **iter;
HRESULT hres;
TRACE("(%p)\n", module);
if(!module)
return E_INVALIDARG;
for(iter = module->m_ppAutoObjMapFirst; iter < module->m_ppAutoObjMapLast; iter++) {
if(!(*iter))
continue;
hres = CoRevokeClassObject((*iter)->pCache->dwRegister);
if(FAILED(hres))
return hres;
}
return S_OK;
}
#endif
/***********************************************************************
* AtlComModuleUnregisterServer [atl100.22]
*/
#if _ATL_VER < _ATL_VER_110
HRESULT WINAPI AtlComModuleUnregisterServer(_ATL_COM_MODULE *mod, BOOL bRegTypeLib, const CLSID *clsid)
{
const struct _ATL_CATMAP_ENTRY *catmap;
......@@ -615,6 +684,56 @@ HRESULT WINAPI AtlComModuleUnregisterServer(_ATL_COM_MODULE *mod, BOOL bRegTypeL
return S_OK;
}
#else
HRESULT WINAPI AtlComModuleUnregisterServer(_ATL_COM_MODULE *mod, BOOL bRegTypeLib, const CLSID *clsid)
{
const struct _ATL_CATMAP_ENTRY *catmap;
_ATL_OBJMAP_ENTRY_EX **iter;
HRESULT hres;
TRACE("(%p %x %s)\n", mod, bRegTypeLib, debugstr_guid(clsid));
for(iter = mod->m_ppAutoObjMapFirst; iter < mod->m_ppAutoObjMapLast; iter++) {
if(!*iter || (clsid && !IsEqualCLSID((*iter)->pclsid, clsid)))
continue;
TRACE("Unregistering clsid %s\n", debugstr_guid((*iter)->pclsid));
catmap = (*iter)->pfnGetCategoryMap();
if(catmap) {
hres = AtlRegisterClassCategoriesHelper((*iter)->pclsid, catmap, FALSE);
if(FAILED(hres))
return hres;
}
hres = (*iter)->pfnUpdateRegistry(FALSE);
if(FAILED(hres))
return hres;
}
if(bRegTypeLib) {
ITypeLib *typelib;
TLIBATTR *attr;
BSTR path;
hres = AtlLoadTypeLib(mod->m_hInstTypeLib, NULL, &path, &typelib);
if(FAILED(hres))
return hres;
SysFreeString(path);
hres = ITypeLib_GetLibAttr(typelib, &attr);
if(SUCCEEDED(hres)) {
hres = UnRegisterTypeLib(&attr->guid, attr->wMajorVerNum, attr->wMinorVerNum, attr->lcid, attr->syskind);
ITypeLib_ReleaseTLibAttr(typelib, attr);
}
ITypeLib_Release(typelib);
if(FAILED(hres))
return hres;
}
return S_OK;
}
#endif
#endif
......@@ -662,20 +781,15 @@ HRESULT WINAPI AtlRegisterClassCategoriesHelper(REFCLSID clsid, const struct _AT
}
if(!reg) {
WCHAR reg_path[256] = {'C','L','S','I','D','\\'}, *ptr = reg_path+6;
static const WCHAR implemented_catW[] =
{'I','m','p','l','e','m','e','n','t','e','d',' ','C','a','t','e','g','o','r','i','e','s',0};
static const WCHAR required_catW[] =
{'R','e','q','u','i','r','e','d',' ','C','a','t','e','g','o','r','i','e','s',0};
WCHAR reg_path[256] = L"CLSID\\", *ptr = reg_path+6;
ptr += StringFromGUID2(clsid, ptr, 64)-1;
*ptr++ = '\\';
memcpy(ptr, implemented_catW, sizeof(implemented_catW));
lstrcpyW(ptr, L"Implemented Categories");
RegDeleteKeyW(HKEY_CLASSES_ROOT, reg_path);
memcpy(ptr, required_catW, sizeof(required_catW));
lstrcpyW(ptr, L"Required Categories");
RegDeleteKeyW(HKEY_CLASSES_ROOT, reg_path);
}
......@@ -855,11 +969,10 @@ DWORD WINAPI AtlGetVersion(void *pReserved)
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
TRACE("(0x%p, %ld, %p)\n", hinstDLL, fdwReason, lpvReserved);
switch(fdwReason) {
case DLL_PROCESS_ATTACH:
atl_instance = hinstDLL;
DisableThreadLibraryCalls(hinstDLL);
break;
case DLL_PROCESS_DETACH:
......
......@@ -8,7 +8,7 @@
13 stdcall AtlMarshalPtrInProc(ptr ptr ptr)
14 stdcall AtlUnmarshalPtr(ptr ptr ptr)
15 stdcall AtlModuleGetClassObject(ptr ptr ptr ptr)
16 stdcall AtlModuleInit(ptr long long)
16 stdcall AtlModuleInit(ptr ptr long)
17 stdcall AtlModuleRegisterClassObjects(ptr long long)
18 stdcall AtlModuleRegisterServer(ptr long ptr)
19 stdcall AtlModuleRegisterTypeLib(ptr wstr)
......
......@@ -29,12 +29,9 @@
#include "atlwin.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(atl);
extern HINSTANCE atl_instance;
#define ATLVer1Size FIELD_OFFSET(_ATL_MODULEW, dwAtlBuildVer)
HRESULT WINAPI AtlModuleInit(_ATL_MODULEW* pM, _ATL_OBJMAP_ENTRYW* p, HINSTANCE h)
......@@ -124,7 +121,7 @@ HRESULT WINAPI AtlModuleTerm(_ATL_MODULE *pM)
iter->pFunc(iter->dw);
tmp = iter;
iter = iter->pNext;
HeapFree(GetProcessHeap(), 0, tmp);
free(tmp);
}
}
......@@ -137,7 +134,7 @@ HRESULT WINAPI AtlModuleRegisterClassObjects(_ATL_MODULEW *pM, DWORD dwClsContex
_ATL_OBJMAP_ENTRYW_V1 *obj;
int i=0;
TRACE("(%p %i %i)\n",pM, dwClsContext, dwFlags);
TRACE("(%p %li %li)\n",pM, dwClsContext, dwFlags);
if (pM == NULL)
return E_INVALIDARG;
......@@ -158,7 +155,7 @@ HRESULT WINAPI AtlModuleRegisterClassObjects(_ATL_MODULEW *pM, DWORD dwClsContex
dwFlags, &obj->dwRegister);
if (FAILED (rc) )
WARN("Failed to register object %i: 0x%08x\n", i, rc);
WARN("Failed to register object %i: 0x%08lx\n", i, rc);
if (pUnknown)
IUnknown_Release(pUnknown);
......@@ -250,7 +247,7 @@ HRESULT WINAPI AtlModuleGetClassObject(_ATL_MODULEW *pm, REFCLSID rclsid,
(void **)&obj->pCF);
if (obj->pCF)
hres = IUnknown_QueryInterface(obj->pCF, riid, ppv);
break;
return hres;
}
}
}
......@@ -261,7 +258,7 @@ HRESULT WINAPI AtlModuleGetClassObject(_ATL_MODULEW *pm, REFCLSID rclsid,
}
/***********************************************************************
* AtlModuleGetClassObject [ATL.@]
* AtlModuleRegisterTypeLib [ATL.@]
*/
HRESULT WINAPI AtlModuleRegisterTypeLib(_ATL_MODULEW *pm, LPCOLESTR lpszIndex)
{
......@@ -314,7 +311,7 @@ ATOM WINAPI AtlModuleRegisterWndClassInfoA(_ATL_MODULEA *pm, _ATL_WNDCLASSINFOA
if (!wci->m_wc.lpszClassName)
{
snprintf(wci->m_szAutoName, sizeof(wci->m_szAutoName), "ATL%08lx", (UINT_PTR)wci);
sprintf(wci->m_szAutoName, "ATL:%p", wci);
TRACE("auto-generated class name %s\n", wci->m_szAutoName);
wci->m_wc.lpszClassName = wci->m_szAutoName;
}
......@@ -351,8 +348,8 @@ ATOM WINAPI AtlModuleRegisterWndClassInfoA(_ATL_MODULEA *pm, _ATL_WNDCLASSINFOA
* NOTES
* Can be called multiple times without error, unlike RegisterClassEx().
*
* If the class name is NULL, then a class with a name of "ATLxxxxxxxx" is
* registered, where the 'x's represent a unique value.
* If the class name is NULL, then a class with a name of "ATL:xxxxxxxx" is
* registered, where 'xxxxxxxx' represents a unique hexadecimal value.
*
*/
ATOM WINAPI AtlModuleRegisterWndClassInfoW(_ATL_MODULEW *pm, _ATL_WNDCLASSINFOW *wci, WNDPROC *pProc)
......@@ -373,8 +370,7 @@ ATOM WINAPI AtlModuleRegisterWndClassInfoW(_ATL_MODULEW *pm, _ATL_WNDCLASSINFOW
if (!wci->m_wc.lpszClassName)
{
static const WCHAR szFormat[] = {'A','T','L','%','0','8','l','x',0};
snprintfW(wci->m_szAutoName, sizeof(wci->m_szAutoName)/sizeof(WCHAR), szFormat, (UINT_PTR)wci);
swprintf(wci->m_szAutoName, ARRAY_SIZE(wci->m_szAutoName), L"ATL:%p", wci);
TRACE("auto-generated class name %s\n", debugstr_w(wci->m_szAutoName));
wci->m_wc.lpszClassName = wci->m_szAutoName;
}
......@@ -530,27 +526,3 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, LPVOID *ppvObject)
FIXME("Not supported class %s\n", debugstr_guid(clsid));
return CLASS_E_CLASSNOTAVAILABLE;
}
/***********************************************************************
* DllRegisterServer (ATL.@)
*/
HRESULT WINAPI DllRegisterServer(void)
{
return __wine_register_resources( atl_instance );
}
/***********************************************************************
* DllUnRegisterServer (ATL.@)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
return __wine_unregister_resources( atl_instance );
}
/***********************************************************************
* DllCanUnloadNow (ATL.@)
*/
HRESULT WINAPI DllCanUnloadNow(void)
{
return S_FALSE;
}
......@@ -37,7 +37,6 @@
#include "atlwin.h"
#include "shlwapi.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(atl);
......@@ -56,8 +55,6 @@ typedef struct IOCS {
BOOL fActive, fInPlace, fWindowless;
} IOCS;
static const WCHAR wine_atl_iocsW[] = {'_','_','W','I','N','E','_','A','T','L','_','I','O','C','S','\0'};
/**********************************************************************
* AtlAxWin class window procedure
*/
......@@ -66,12 +63,12 @@ static LRESULT CALLBACK AtlAxWin_wndproc( HWND hWnd, UINT wMsg, WPARAM wParam, L
if ( wMsg == WM_CREATE )
{
DWORD len = GetWindowTextLengthW( hWnd ) + 1;
WCHAR *ptr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
WCHAR *ptr = malloc( len*sizeof(WCHAR) );
if (!ptr)
return 1;
GetWindowTextW( hWnd, ptr, len );
AtlAxCreateControlEx( ptr, hWnd, NULL, NULL, NULL, NULL, NULL );
HeapFree( GetProcessHeap(), 0, ptr );
free( ptr );
return 0;
}
return DefWindowProcW( hWnd, wMsg, wParam, lParam );
......@@ -91,20 +88,20 @@ BOOL WINAPI AtlAxWinInit(void)
WNDCLASSEXW wcex;
#if _ATL_VER <= _ATL_VER_30
#define ATL_NAME_SUFFIX 0
#define ATL_NAME_SUFFIX
#elif _ATL_VER == _ATL_VER_80
#define ATL_NAME_SUFFIX '8','0',0
#define ATL_NAME_SUFFIX L"80"
#elif _ATL_VER == _ATL_VER_90
#define ATL_NAME_SUFFIX '9','0',0
#define ATL_NAME_SUFFIX L"90"
#elif _ATL_VER == _ATL_VER_100
#define ATL_NAME_SUFFIX '1','0','0',0
#define ATL_NAME_SUFFIX L"100"
#elif _ATL_VER == _ATL_VER_110
#define ATL_NAME_SUFFIX '1','1','0',0
#define ATL_NAME_SUFFIX L"110"
#else
#error Unsupported version
#endif
const WCHAR AtlAxWinW[] = {'A','t','l','A','x','W','i','n',ATL_NAME_SUFFIX};
static const WCHAR AtlAxWinW[] = L"AtlAxWin" ATL_NAME_SUFFIX;
FIXME("version %04x semi-stub\n", _ATL_VER);
......@@ -128,7 +125,7 @@ BOOL WINAPI AtlAxWinInit(void)
return FALSE;
if(_ATL_VER > _ATL_VER_30) {
const WCHAR AtlAxWinLicW[] = {'A','t','l','A','x','W','i','n','L','i','c',ATL_NAME_SUFFIX};
static const WCHAR AtlAxWinLicW[] = L"AtlAxWinLic" ATL_NAME_SUFFIX;
wcex.lpszClassName = AtlAxWinLicW;
if ( !RegisterClassExW( &wcex ) )
......@@ -153,7 +150,7 @@ static HRESULT IOCS_Detach( IOCS *This ) /* remove subclassing */
if ( This->hWnd )
{
SetWindowLongPtrW( This->hWnd, GWLP_WNDPROC, (ULONG_PTR) This->OrigWndProc );
RemovePropW( This->hWnd, wine_atl_iocsW);
RemovePropW( This->hWnd, L"__WINE_ATL_IOCS" );
This->hWnd = NULL;
}
if ( This->control )
......@@ -214,7 +211,7 @@ static ULONG WINAPI OleClientSite_AddRef(IOleClientSite *iface)
{
IOCS *This = impl_from_IOleClientSite(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("(%p)->(%ld)\n", This, ref);
return ref;
}
......@@ -223,12 +220,12 @@ static ULONG WINAPI OleClientSite_Release(IOleClientSite *iface)
IOCS *This = impl_from_IOleClientSite(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%d)\n", This, ref);
TRACE("(%p)->(%ld)\n", This, ref);
if (!ref)
{
IOCS_Detach( This );
HeapFree( GetProcessHeap(), 0, This );
free( This );
}
return ref;
......@@ -245,7 +242,7 @@ static HRESULT WINAPI OleClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAs
{
IOCS *This = impl_from_IOleClientSite(iface);
FIXME( "(%p, 0x%x, 0x%x, %p)\n", This, dwAssign, dwWhichMoniker, ppmk );
FIXME( "(%p, 0x%lx, 0x%lx, %p)\n", This, dwAssign, dwWhichMoniker, ppmk );
return E_NOTIMPL;
}
......@@ -313,7 +310,7 @@ static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer* iface, IBindC
static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer* iface, DWORD grfFlags, IEnumUnknown** ppenum)
{
IOCS *This = impl_from_IOleContainer(iface);
FIXME( "(%p, %u, %p) - stub\n", This, grfFlags, ppenum );
FIXME( "(%p, %lu, %p) - stub\n", This, grfFlags, ppenum );
return E_NOTIMPL;
}
......@@ -827,7 +824,7 @@ static void IOCS_OnSize( IOCS* This, LPCRECT rect )
{
SIZEL inPix, inHi;
This->size.left = rect->left; This->size.right = rect->right; This->size.top = rect->top; This->size.bottom = rect->bottom;
This->size = *rect;
if ( !This->control )
return;
......@@ -890,9 +887,7 @@ static LRESULT IOCS_OnWndProc( IOCS *This, HWND hWnd, UINT uMsg, WPARAM wParam,
case WM_SIZE:
{
RECT r;
r.left = r.top = 0;
r.right = LOWORD( lParam );
r.bottom = HIWORD( lParam );
SetRect(&r, 0, 0, LOWORD(lParam), HIWORD(lParam));
IOCS_OnSize( This, &r );
}
break;
......@@ -909,7 +904,7 @@ static LRESULT IOCS_OnWndProc( IOCS *This, HWND hWnd, UINT uMsg, WPARAM wParam,
static LRESULT CALLBACK AtlHost_wndproc( HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam )
{
IOCS *This = (IOCS*) GetPropW( hWnd, wine_atl_iocsW );
IOCS *This = (IOCS*) GetPropW( hWnd, L"__WINE_ATL_IOCS" );
return IOCS_OnWndProc( This, hWnd, wMsg, wParam, lParam );
}
......@@ -918,7 +913,7 @@ static HRESULT IOCS_Attach( IOCS *This, HWND hWnd, IUnknown *pUnkControl ) /* su
This->hWnd = hWnd;
IUnknown_QueryInterface( pUnkControl, &IID_IOleObject, (void**)&This->control );
IOleObject_SetClientSite( This->control, &This->IOleClientSite_iface );
SetPropW( hWnd, wine_atl_iocsW, This );
SetPropW( hWnd, L"__WINE_ATL_IOCS", This );
This->OrigWndProc = (WNDPROC)SetWindowLongPtrW( hWnd, GWLP_WNDPROC, (ULONG_PTR) AtlHost_wndproc );
return S_OK;
......@@ -927,9 +922,8 @@ static HRESULT IOCS_Attach( IOCS *This, HWND hWnd, IUnknown *pUnkControl ) /* su
static HRESULT IOCS_Init( IOCS *This )
{
RECT rect;
static const WCHAR AXWIN[] = {'A','X','W','I','N',0};
IOleObject_SetHostNames( This->control, AXWIN, AXWIN );
IOleObject_SetHostNames( This->control, L"AXWIN", L"AXWIN" );
GetClientRect( This->hWnd, &rect );
IOCS_OnSize( This, &rect );
......@@ -951,7 +945,7 @@ static HRESULT IOCS_Create( HWND hWnd, IUnknown *pUnkControl, IUnknown **contain
return S_OK;
*container = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(IOCS));
This = malloc(sizeof(*This));
if (!This)
return E_OUTOFMEMORY;
......@@ -975,7 +969,7 @@ static HRESULT IOCS_Create( HWND hWnd, IUnknown *pUnkControl, IUnknown **contain
else
{
IOCS_Detach( This );
HeapFree(GetProcessHeap(), 0, This);
free(This);
}
return hr;
......@@ -1005,7 +999,6 @@ static enum content get_content_type(LPCOLESTR name, CLSID *control_id)
{
WCHAR new_urlW[MAX_PATH];
DWORD size = MAX_PATH;
WCHAR mshtml_prefixW[] = {'m','s','h','t','m','l',':','\0'};
if (!name || !name[0])
{
......@@ -1024,7 +1017,7 @@ static enum content get_content_type(LPCOLESTR name, CLSID *control_id)
return IsURL;
}
if (!strncmpiW(name, mshtml_prefixW, 7))
if (!wcsnicmp(name, L"mshtml:", 7))
{
FIXME("mshtml prefix not implemented\n");
*control_id = CLSID_WebBrowser;
......@@ -1074,7 +1067,7 @@ HRESULT WINAPI AtlAxCreateControlLicEx(LPCOLESTR lpszName, HWND hWnd,
(void**) &pControl );
if ( FAILED( hRes ) )
{
WARN( "cannot create ActiveX control %s instance - error 0x%08x\n",
WARN( "cannot create ActiveX control %s instance - error 0x%08lx\n",
debugstr_guid( &controlId ), hRes );
return hRes;
}
......@@ -1104,7 +1097,7 @@ HRESULT WINAPI AtlAxCreateControlLicEx(LPCOLESTR lpszName, HWND hWnd,
hRes = IOleObject_QueryInterface( pControl, &IID_IWebBrowser2, (void**) &browser );
if ( !browser )
WARN( "Cannot query IWebBrowser2 interface: %08x\n", hRes );
WARN( "Cannot query IWebBrowser2 interface: %08lx\n", hRes );
else {
VARIANT url;
......@@ -1115,7 +1108,7 @@ HRESULT WINAPI AtlAxCreateControlLicEx(LPCOLESTR lpszName, HWND hWnd,
hRes = IWebBrowser2_Navigate2( browser, &url, NULL, NULL, NULL, NULL );
if ( FAILED( hRes ) )
WARN( "IWebBrowser2::Navigate2 failed: %08x\n", hRes );
WARN( "IWebBrowser2::Navigate2 failed: %08lx\n", hRes );
SysFreeString( V_BSTR(&url) );
IWebBrowser2_Release( browser );
......@@ -1167,7 +1160,7 @@ static inline BOOL advance_array(WORD **pptr, DWORD *palloc, DWORD *pfilled, con
if ( (*pfilled + size) > *palloc )
{
*palloc = ((*pfilled+size) + 0xFF) & ~0xFF;
*pptr = HeapReAlloc( GetProcessHeap(), 0, *pptr, *palloc * sizeof(WORD) );
*pptr = realloc( *pptr, *palloc * sizeof(WORD) );
if (!*pptr)
return FALSE;
}
......@@ -1193,7 +1186,7 @@ static LPDLGTEMPLATEW AX_ConvertDialogTemplate(LPCDLGTEMPLATEW src_tmpl)
DWORD style;
filled = 0; allocated = 256;
output = HeapAlloc( GetProcessHeap(), 0, allocated * sizeof(WORD) );
output = malloc( allocated * sizeof(WORD) );
if (!output)
return NULL;
......@@ -1212,16 +1205,16 @@ static LPDLGTEMPLATEW AX_ConvertDialogTemplate(LPCDLGTEMPLATEW src_tmpl)
if ( GET_WORD(src) == 0xFFFF ) /* menu */
src += 2;
else
src += strlenW(src) + 1;
src += lstrlenW(src) + 1;
if ( GET_WORD(src) == 0xFFFF ) /* class */
src += 2;
else
src += strlenW(src) + 1;
src += strlenW(src) + 1; /* title */
src += lstrlenW(src) + 1;
src += lstrlenW(src) + 1; /* title */
if ( style & (DS_SETFONT | DS_SHELLFONT) )
{
src += 3;
src += strlenW(src) + 1;
src += lstrlenW(src) + 1;
}
} else {
ext = FALSE;
......@@ -1232,16 +1225,16 @@ static LPDLGTEMPLATEW AX_ConvertDialogTemplate(LPCDLGTEMPLATEW src_tmpl)
if ( GET_WORD(src) == 0xFFFF ) /* menu */
src += 2;
else
src += strlenW(src) + 1;
src += lstrlenW(src) + 1;
if ( GET_WORD(src) == 0xFFFF ) /* class */
src += 2;
else
src += strlenW(src) + 1;
src += strlenW(src) + 1; /* title */
src += lstrlenW(src) + 1;
src += lstrlenW(src) + 1; /* title */
if ( style & DS_SETFONT )
{
src++;
src += strlenW(src) + 1;
src += lstrlenW(src) + 1;
}
}
PUT_BLOCK(tmp, src-tmp);
......@@ -1264,14 +1257,13 @@ static LPDLGTEMPLATEW AX_ConvertDialogTemplate(LPCDLGTEMPLATEW src_tmpl)
src += 2;
} else
{
src += strlenW(src) + 1;
src += lstrlenW(src) + 1;
}
src += strlenW(src) + 1; /* title */
src += lstrlenW(src) + 1; /* title */
if ( GET_WORD(tmp) == '{' ) /* all this mess created because of this line */
{
static const WCHAR AtlAxWin[] = {'A','t','l','A','x','W','i','n', 0};
PUT_BLOCK(AtlAxWin, sizeof(AtlAxWin)/sizeof(WCHAR));
PUT_BLOCK(tmp, strlenW(tmp)+1);
PUT_BLOCK(L"AtlAxWin", ARRAY_SIZE(L"AtlAxWin"));
PUT_BLOCK(tmp, lstrlenW(tmp)+1);
} else
PUT_BLOCK(tmp, src-tmp);
......@@ -1315,12 +1307,12 @@ HWND WINAPI AtlAxCreateDialogA(HINSTANCE hInst, LPCSTR name, HWND owner, DLGPROC
return AtlAxCreateDialogW( hInst, (LPCWSTR) name, owner, dlgProc, param );
length = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
nameW = HeapAlloc( GetProcessHeap(), 0, length * sizeof(WCHAR) );
nameW = malloc( length * sizeof(WCHAR) );
if (nameW)
{
MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, length );
res = AtlAxCreateDialogW( hInst, nameW, owner, dlgProc, param );
HeapFree( GetProcessHeap(), 0, nameW );
free( nameW );
}
return res;
}
......@@ -1339,7 +1331,7 @@ HWND WINAPI AtlAxCreateDialogW(HINSTANCE hInst, LPCWSTR name, HWND owner, DLGPRO
LPDLGTEMPLATEW newptr;
HWND res;
TRACE("(%p %s %p %p %lx)\n", hInst, debugstr_w(name), owner, dlgProc, param);
TRACE("(%p %s %p %p %Ix)\n", hInst, debugstr_w(name), owner, dlgProc, param);
hrsrc = FindResourceW( hInst, name, (LPWSTR)RT_DIALOG );
if ( !hrsrc )
......@@ -1356,8 +1348,8 @@ HWND WINAPI AtlAxCreateDialogW(HINSTANCE hInst, LPCWSTR name, HWND owner, DLGPRO
newptr = AX_ConvertDialogTemplate( ptr );
if ( newptr )
{
res = CreateDialogIndirectParamW( hInst, newptr, owner, dlgProc, param );
HeapFree( GetProcessHeap(), 0, newptr );
res = CreateDialogIndirectParamW( hInst, newptr, owner, dlgProc, param );
free( newptr );
} else
res = NULL;
FreeResource ( hrsrc );
......@@ -1376,7 +1368,7 @@ HRESULT WINAPI AtlAxGetHost(HWND hWnd, IUnknown **host)
*host = NULL;
This = (IOCS*) GetPropW( hWnd, wine_atl_iocsW );
This = (IOCS*) GetPropW( hWnd, L"__WINE_ATL_IOCS" );
if ( !This )
{
WARN("No container attached to %p\n", hWnd );
......@@ -1398,7 +1390,7 @@ HRESULT WINAPI AtlAxGetControl(HWND hWnd, IUnknown **pUnk)
*pUnk = NULL;
This = (IOCS*) GetPropW( hWnd, wine_atl_iocsW );
This = (IOCS*) GetPropW( hWnd, L"__WINE_ATL_IOCS" );
if ( !This || !This->control )
{
WARN("No control attached to %p\n", hWnd );
......@@ -1412,22 +1404,52 @@ HRESULT WINAPI AtlAxGetControl(HWND hWnd, IUnknown **pUnk)
* AtlAxDialogBoxW [atl100.35]
*
*/
INT_PTR WINAPI AtlAxDialogBoxW(HINSTANCE hInstance, LPCWSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogProc,
LPARAM dwInitParam)
INT_PTR WINAPI AtlAxDialogBoxW(HINSTANCE instance, const WCHAR *name,
HWND owner, DLGPROC proc, LPARAM param)
{
FIXME("(%p %s %p %p %lx)\n", hInstance, debugstr_w(lpTemplateName), hWndParent, lpDialogProc, dwInitParam);
return 0;
HRSRC resource;
HGLOBAL global;
DLGTEMPLATE *template;
INT_PTR ret;
TRACE("instance %p, name %s, owner %p, proc %p, param %#Ix\n",
instance, debugstr_w(name), owner, proc, param);
if (!(resource = FindResourceW(instance, name, (const WCHAR *)RT_DIALOG)))
return 0;
if (!(global = LoadResource(instance, resource)))
return 0;
if (!(template = AX_ConvertDialogTemplate(LockResource(global))))
return 0;
ret = DialogBoxIndirectParamW(instance, template, owner, proc, param);
free(template);
return ret;
}
/***********************************************************************
* AtlAxDialogBoxA [atl100.36]
*
*/
INT_PTR WINAPI AtlAxDialogBoxA(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogProc,
LPARAM dwInitParam)
INT_PTR WINAPI AtlAxDialogBoxA(HINSTANCE instance, const char *name,
HWND owner, DLGPROC proc, LPARAM param)
{
FIXME("(%p %s %p %p %lx)\n", hInstance, debugstr_a(lpTemplateName), hWndParent, lpDialogProc, dwInitParam);
return 0;
WCHAR *nameW;
int len;
INT_PTR ret;
if (IS_INTRESOURCE(name))
return AtlAxDialogBoxW(instance, (const WCHAR *)name, owner, proc, param);
len = MultiByteToWideChar(CP_ACP, 0, name, -1, NULL, 0);
if (!(nameW = malloc(len * sizeof(WCHAR))))
return 0;
MultiByteToWideChar(CP_ACP, 0, name, -1, nameW, len);
ret = AtlAxDialogBoxW(instance, nameW, owner, proc, param);
free(nameW);
return ret;
}
/***********************************************************************
......
......@@ -17,7 +17,6 @@
*/
#pragma makedep regtypelib
#pragma makedep register
import "atliface.idl";
......
......@@ -21,7 +21,6 @@
#include "atlbase.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(atl);
......@@ -33,27 +32,20 @@ static const struct {
WCHAR name[22];
HKEY key;
} root_keys[] = {
{{'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0},
HKEY_CLASSES_ROOT},
{{'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R',0},
HKEY_CURRENT_USER},
{{'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E',0},
HKEY_LOCAL_MACHINE},
{{'H','K','E','Y','_','U','S','E','R','S',0},
HKEY_USERS},
{{'H','K','E','Y','_','P','E','R','F','O','R','M','A','N','C','E','_','D','A','T','A',0},
HKEY_PERFORMANCE_DATA},
{{'H','K','E','Y','_','D','Y','N','_','D','A','T','A',0},
HKEY_DYN_DATA},
{{'H','K','E','Y','_','C','U','R','R','E','N','T','_','C','O','N','F','I','G',0},
HKEY_CURRENT_CONFIG},
{{'H','K','C','R',0}, HKEY_CLASSES_ROOT},
{{'H','K','C','U',0}, HKEY_CURRENT_USER},
{{'H','K','L','M',0}, HKEY_LOCAL_MACHINE},
{{'H','K','U',0}, HKEY_USERS},
{{'H','K','P','D',0}, HKEY_PERFORMANCE_DATA},
{{'H','K','D','D',0}, HKEY_DYN_DATA},
{{'H','K','C','C',0}, HKEY_CURRENT_CONFIG}
{L"HKEY_CLASSES_ROOT", HKEY_CLASSES_ROOT},
{L"HKEY_CURRENT_USER", HKEY_CURRENT_USER},
{L"HKEY_LOCAL_MACHINE", HKEY_LOCAL_MACHINE},
{L"HKEY_USERS", HKEY_USERS},
{L"HKEY_PERFORMANCE_DATA", HKEY_PERFORMANCE_DATA},
{L"HKEY_DYN_DATA", HKEY_DYN_DATA},
{L"HKEY_CURRENT_CONFIG", HKEY_CURRENT_CONFIG},
{L"HKCR", HKEY_CLASSES_ROOT},
{L"HKCU", HKEY_CURRENT_USER},
{L"HKLM", HKEY_LOCAL_MACHINE},
{L"HKU", HKEY_USERS},
{L"HKPD", HKEY_PERFORMANCE_DATA},
{L"HKDD", HKEY_DYN_DATA},
{L"HKCC", HKEY_CURRENT_CONFIG}
};
typedef struct rep_list_str {
......@@ -82,7 +74,7 @@ static inline Registrar *impl_from_IRegistrar(IRegistrar *iface)
static void strbuf_init(strbuf *buf)
{
buf->str = HeapAlloc(GetProcessHeap(), 0, 128*sizeof(WCHAR));
buf->str = malloc(128*sizeof(WCHAR));
buf->alloc = 128;
buf->len = 0;
}
......@@ -93,13 +85,21 @@ static void strbuf_write(LPCOLESTR str, strbuf *buf, int len)
len = lstrlenW(str);
if(buf->len+len+1 >= buf->alloc) {
buf->alloc = (buf->len+len)<<1;
buf->str = HeapReAlloc(GetProcessHeap(), 0, buf->str, buf->alloc*sizeof(WCHAR));
buf->str = realloc(buf->str, buf->alloc*sizeof(WCHAR));
}
memcpy(buf->str+buf->len, str, len*sizeof(OLECHAR));
buf->len += len;
buf->str[buf->len] = '\0';
}
static int xdigit_to_int(WCHAR c)
{
if('0' <= c && c <= '9') return c - '0';
if('a' <= c && c <= 'f') return c - 'a' + 10;
if('A' <= c && c <= 'F') return c - 'A' + 10;
return -1;
}
static HRESULT get_word(LPCOLESTR *str, strbuf *buf)
{
LPCOLESTR iter, iter2 = *str;
......@@ -107,7 +107,7 @@ static HRESULT get_word(LPCOLESTR *str, strbuf *buf)
buf->len = 0;
buf->str[0] = '\0';
while(isspaceW(*iter2))
while(iswspace(*iter2))
iter2++;
iter = iter2;
if(!*iter) {
......@@ -118,22 +118,28 @@ static HRESULT get_word(LPCOLESTR *str, strbuf *buf)
if(*iter == '}' || *iter == '=') {
strbuf_write(iter++, buf, 1);
}else if(*iter == '\'') {
iter2 = ++iter;
iter = strchrW(iter, '\'');
if(!iter) {
WARN("Unexpected end of script\n");
*str = iter;
return DISP_E_EXCEPTION;
for (;;)
{
iter2 = ++iter;
iter = wcschr(iter, '\'');
if(!iter) {
WARN("Unexpected end of script\n");
*str = iter;
return DISP_E_EXCEPTION;
}
if (iter[1] != '\'') break;
iter++;
strbuf_write(iter2, buf, iter-iter2);
}
strbuf_write(iter2, buf, iter-iter2);
iter++;
}else {
while(*iter && !isspaceW(*iter))
while(*iter && !iswspace(*iter))
iter++;
strbuf_write(iter2, buf, iter-iter2);
}
while(isspaceW(*iter))
while(iswspace(*iter))
iter++;
*str = iter;
return S_OK;
......@@ -143,25 +149,24 @@ static HRESULT do_preprocess(const Registrar *This, LPCOLESTR data, strbuf *buf)
{
LPCOLESTR iter, iter2 = data;
rep_list *rep_iter;
static const WCHAR wstr[] = {'%',0};
iter = strchrW(data, '%');
iter = wcschr(data, '%');
while(iter) {
strbuf_write(iter2, buf, iter-iter2);
iter2 = ++iter;
if(!*iter2)
return DISP_E_EXCEPTION;
iter = strchrW(iter2, '%');
iter = wcschr(iter2, '%');
if(!iter)
return DISP_E_EXCEPTION;
if(iter == iter2) {
strbuf_write(wstr, buf, 1);
strbuf_write(L"%", buf, 1);
}else {
for(rep_iter = This->rep; rep_iter; rep_iter = rep_iter->next) {
if(rep_iter->key_len == iter-iter2
&& !memicmpW(iter2, rep_iter->key, rep_iter->key_len))
&& !wcsnicmp(iter2, rep_iter->key, rep_iter->key_len))
break;
}
if(!rep_iter) {
......@@ -173,7 +178,7 @@ static HRESULT do_preprocess(const Registrar *This, LPCOLESTR data, strbuf *buf)
}
iter2 = ++iter;
iter = strchrW(iter, '%');
iter = wcschr(iter, '%');
}
strbuf_write(iter2, buf, -1);
......@@ -198,11 +203,6 @@ static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOO
DO_DELETE
} key_type = NORMAL;
static const WCHAR wstrNoRemove[] = {'N','o','R','e','m','o','v','e',0};
static const WCHAR wstrForceRemove[] = {'F','o','r','c','e','R','e','m','o','v','e',0};
static const WCHAR wstrDelete[] = {'D','e','l','e','t','e',0};
static const WCHAR wstrval[] = {'v','a','l',0};
iter = *pstr;
hres = get_word(&iter, buf);
if(FAILED(hres))
......@@ -211,13 +211,13 @@ static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOO
while(buf->str[1] || buf->str[0] != '}') {
key_type = NORMAL;
if(!lstrcmpiW(buf->str, wstrNoRemove))
if(!lstrcmpiW(buf->str, L"NoRemove"))
key_type = NO_REMOVE;
else if(!lstrcmpiW(buf->str, wstrForceRemove))
else if(!lstrcmpiW(buf->str, L"ForceRemove"))
key_type = FORCE_REMOVE;
else if(!lstrcmpiW(buf->str, wstrval))
else if(!lstrcmpiW(buf->str, L"val"))
key_type = IS_VAL;
else if(!lstrcmpiW(buf->str, wstrDelete))
else if(!lstrcmpiW(buf->str, L"Delete"))
key_type = DO_DELETE;
if(key_type != NORMAL) {
......@@ -239,7 +239,7 @@ static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOO
RegDeleteTreeW(parent_key, buf->str);
lres = RegCreateKeyW(parent_key, buf->str, &hkey);
if(lres != ERROR_SUCCESS) {
WARN("Could not create(open) key: %08x\n", lres);
WARN("Could not create(open) key: %08lx\n", lres);
hres = HRESULT_FROM_WIN32(lres);
break;
}
......@@ -248,7 +248,7 @@ static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOO
strbuf_write(buf->str, &name, -1);
lres = RegOpenKeyW(parent_key, buf->str, &hkey);
if(lres != ERROR_SUCCESS)
WARN("Could not open key %s: %08x\n", debugstr_w(name.str), lres);
WARN("Could not open key %s: %08lx\n", debugstr_w(name.str), lres);
}
if(key_type != DO_DELETE && *iter == '=') {
......@@ -270,7 +270,7 @@ static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOO
lres = RegSetValueExW(hkey, name.len ? name.str : NULL, 0, REG_SZ, (PBYTE)buf->str,
(lstrlenW(buf->str)+1)*sizeof(WCHAR));
if(lres != ERROR_SUCCESS) {
WARN("Could set value of key: %08x\n", lres);
WARN("Could set value of key: %08lx\n", lres);
hres = HRESULT_FROM_WIN32(lres);
break;
}
......@@ -280,11 +280,11 @@ static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOO
hres = get_word(&iter, buf);
if(FAILED(hres))
break;
dw = atoiW(buf->str);
dw = wcstoul(buf->str, NULL, 10);
lres = RegSetValueExW(hkey, name.len ? name.str : NULL, 0, REG_DWORD,
(PBYTE)&dw, sizeof(dw));
if(lres != ERROR_SUCCESS) {
WARN("Could set value of key: %08x\n", lres);
WARN("Could set value of key: %08lx\n", lres);
hres = HRESULT_FROM_WIN32(lres);
break;
}
......@@ -298,31 +298,28 @@ static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOO
if(FAILED(hres))
break;
count = (lstrlenW(buf->str) + 1) / 2;
bytes = HeapAlloc(GetProcessHeap(), 0, count);
bytes = malloc(count);
if(bytes == NULL) {
hres = E_OUTOFMEMORY;
break;
}
for(i = 0; i < count && buf->str[2*i]; i++) {
WCHAR digits[3];
if(!isxdigitW(buf->str[2*i]) || !isxdigitW(buf->str[2*i + 1])) {
int d1, d2;
if((d1 = xdigit_to_int(buf->str[2*i])) == -1 || (d2 = xdigit_to_int(buf->str[2*i + 1])) == -1) {
hres = E_FAIL;
break;
}
digits[0] = buf->str[2*i];
digits[1] = buf->str[2*i + 1];
digits[2] = 0;
bytes[i] = (BYTE) strtoulW(digits, NULL, 16);
bytes[i] = (d1 << 4) | d2;
}
if(SUCCEEDED(hres)) {
lres = RegSetValueExW(hkey, name.len ? name.str : NULL, 0, REG_BINARY,
bytes, count);
if(lres != ERROR_SUCCESS) {
WARN("Could not set value of key: 0x%08x\n", lres);
WARN("Could not set value of key: 0x%08lx\n", lres);
hres = HRESULT_FROM_WIN32(lres);
}
}
HeapFree(GetProcessHeap(), 0, bytes);
free(bytes);
break;
}
default:
......@@ -344,7 +341,7 @@ static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOO
break;
}
if(key_type != IS_VAL && key_type != DO_DELETE && *iter == '{' && isspaceW(iter[1])) {
if(key_type != IS_VAL && key_type != DO_DELETE && *iter == '{' && iswspace(iter[1])) {
hres = get_word(&iter, buf);
if(FAILED(hres))
break;
......@@ -369,7 +366,7 @@ static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOO
break;
}
HeapFree(GetProcessHeap(), 0, name.str);
free(name.str);
if(hkey && key_type != IS_VAL)
RegCloseKey(hkey);
*pstr = iter;
......@@ -386,7 +383,7 @@ static HRESULT do_process_root_key(LPCOLESTR data, BOOL do_register)
strbuf_init(&buf);
hres = get_word(&iter, &buf);
if(FAILED(hres))
return hres;
goto done;
while(*iter) {
if(!buf.len) {
......@@ -394,11 +391,11 @@ static HRESULT do_process_root_key(LPCOLESTR data, BOOL do_register)
hres = DISP_E_EXCEPTION;
break;
}
for(i=0; i<sizeof(root_keys)/sizeof(root_keys[0]); i++) {
for(i=0; i<ARRAY_SIZE(root_keys); i++) {
if(!lstrcmpiW(buf.str, root_keys[i].name))
break;
}
if(i == sizeof(root_keys)/sizeof(root_keys[0])) {
if(i == ARRAY_SIZE(root_keys)) {
WARN("Wrong root key name: %s\n", debugstr_w(buf.str));
hres = DISP_E_EXCEPTION;
break;
......@@ -413,14 +410,16 @@ static HRESULT do_process_root_key(LPCOLESTR data, BOOL do_register)
}
hres = do_process_key(&iter, root_keys[i].key, &buf, do_register);
if(FAILED(hres)) {
WARN("Processing key failed: %08x\n", hres);
WARN("Processing key failed: %08lx\n", hres);
break;
}
hres = get_word(&iter, &buf);
if(FAILED(hres))
break;
}
HeapFree(GetProcessHeap(), 0, buf.str);
done:
free(buf.str);
return hres;
}
......@@ -435,7 +434,7 @@ static HRESULT string_register(Registrar *This, LPCOLESTR data, BOOL do_register
hres = do_preprocess(This, data, &buf);
if(FAILED(hres)) {
WARN("preprocessing failed!\n");
HeapFree(GetProcessHeap(), 0, buf.str);
free(buf.str);
return hres;
}
......@@ -443,7 +442,7 @@ static HRESULT string_register(Registrar *This, LPCOLESTR data, BOOL do_register
if(FAILED(hres) && do_register)
do_process_root_key(buf.str, FALSE);
HeapFree(GetProcessHeap(), 0, buf.str);
free(buf.str);
return hres;
}
......@@ -465,13 +464,13 @@ static HRESULT resource_register(Registrar *This, LPCOLESTR resFileName,
reslen = SizeofResource(hins, src);
if(regstra) {
len = MultiByteToWideChar(CP_ACP, 0, regstra, reslen, NULL, 0)+1;
regstrw = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR));
regstrw = calloc(len, sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, regstra, reslen, regstrw, len);
regstrw[len-1] = '\0';
hres = string_register(This, regstrw, do_register);
HeapFree(GetProcessHeap(), 0, regstrw);
free(regstrw);
}else {
WARN("could not load resource\n");
hres = HRESULT_FROM_WIN32(GetLastError());
......@@ -500,21 +499,21 @@ static HRESULT file_register(Registrar *This, LPCOLESTR fileName, BOOL do_regist
file = CreateFileW(fileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if(file != INVALID_HANDLE_VALUE) {
filelen = GetFileSize(file, NULL);
regstra = HeapAlloc(GetProcessHeap(), 0, filelen);
regstra = malloc(filelen);
if(ReadFile(file, regstra, filelen, NULL, NULL)) {
len = MultiByteToWideChar(CP_ACP, 0, regstra, filelen, NULL, 0)+1;
regstrw = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR));
regstrw = calloc(len, sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, regstra, filelen, regstrw, len);
regstrw[len-1] = '\0';
hres = string_register(This, regstrw, do_register);
HeapFree(GetProcessHeap(), 0, regstrw);
free(regstrw);
}else {
WARN("Failed to read file %s\n", debugstr_w(fileName));
hres = HRESULT_FROM_WIN32(GetLastError());
}
HeapFree(GetProcessHeap(), 0, regstra);
free(regstra);
CloseHandle(file);
}else {
WARN("Could not open file %s\n", debugstr_w(fileName));
......@@ -542,7 +541,7 @@ static ULONG WINAPI Registrar_AddRef(IRegistrar *iface)
{
Registrar *This = impl_from_IRegistrar(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ->%d\n", This, ref);
TRACE("(%p) ->%ld\n", This, ref);
return ref;
}
......@@ -551,10 +550,10 @@ static ULONG WINAPI Registrar_Release(IRegistrar *iface)
Registrar *This = impl_from_IRegistrar(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ->%d\n", This, ref);
TRACE("(%p) ->%ld\n", This, ref);
if(!ref) {
IRegistrar_ClearReplacements(iface);
HeapFree(GetProcessHeap(), 0, This);
free(This);
}
return ref;
}
......@@ -567,14 +566,14 @@ static HRESULT WINAPI Registrar_AddReplacement(IRegistrar *iface, LPCOLESTR Key,
TRACE("(%p)->(%s %s)\n", This, debugstr_w(Key), debugstr_w(item));
new_rep = HeapAlloc(GetProcessHeap(), 0, sizeof(rep_list));
new_rep = malloc(sizeof(*new_rep));
new_rep->key_len = lstrlenW(Key);
new_rep->key = HeapAlloc(GetProcessHeap(), 0, (new_rep->key_len + 1) * sizeof(OLECHAR));
new_rep->key = malloc((new_rep->key_len + 1) * sizeof(OLECHAR));
memcpy(new_rep->key, Key, (new_rep->key_len+1)*sizeof(OLECHAR));
len = lstrlenW(item)+1;
new_rep->item = HeapAlloc(GetProcessHeap(), 0, len*sizeof(OLECHAR));
new_rep->item = malloc(len*sizeof(OLECHAR));
memcpy(new_rep->item, item, len*sizeof(OLECHAR));
new_rep->next = This->rep;
......@@ -596,9 +595,9 @@ static HRESULT WINAPI Registrar_ClearReplacements(IRegistrar *iface)
iter = This->rep;
while(iter) {
iter2 = iter->next;
HeapFree(GetProcessHeap(), 0, iter->key);
HeapFree(GetProcessHeap(), 0, iter->item);
HeapFree(GetProcessHeap(), 0, iter);
free(iter->key);
free(iter->item);
free(iter);
iter = iter2;
}
......@@ -689,13 +688,12 @@ HRESULT WINAPI AtlCreateRegistrar(IRegistrar **ret)
{
Registrar *registrar;
registrar = HeapAlloc(GetProcessHeap(), 0, sizeof(*registrar));
registrar = calloc(1, sizeof(*registrar));
if(!registrar)
return E_OUTOFMEMORY;
registrar->IRegistrar_iface.lpVtbl = &RegistrarVtbl;
registrar->ref = 1;
registrar->rep = NULL;
*ret = &registrar->IRegistrar_iface;
return S_OK;
......@@ -712,9 +710,6 @@ HRESULT WINAPI AtlUpdateRegistryFromResourceD(HINSTANCE inst, LPCOLESTR res,
IRegistrar *registrar;
HRESULT hres;
static const WCHAR moduleW[] = {'M','O','D','U','L','E',0};
static const WCHAR registryW[] = {'R','E','G','I','S','T','R','Y',0};
if(!GetModuleFileNameW(inst, module_name, MAX_PATH)) {
FIXME("hinst %p: did not get module name\n", inst);
return E_FAIL;
......@@ -731,15 +726,15 @@ HRESULT WINAPI AtlUpdateRegistryFromResourceD(HINSTANCE inst, LPCOLESTR res,
return hres;
}
IRegistrar_AddReplacement(registrar, moduleW, module_name);
IRegistrar_AddReplacement(registrar, L"MODULE", module_name);
for (iter = pMapEntries; iter && iter->szKey; iter++)
IRegistrar_AddReplacement(registrar, iter->szKey, iter->szData);
if(bRegister)
hres = IRegistrar_ResourceRegisterSz(registrar, module_name, res, registryW);
hres = IRegistrar_ResourceRegisterSz(registrar, module_name, res, L"REGISTRY");
else
hres = IRegistrar_ResourceUnregisterSz(registrar, module_name, res, registryW);
hres = IRegistrar_ResourceUnregisterSz(registrar, module_name, res, L"REGISTRY");
if(registrar != pReg)
IRegistrar_Release(registrar);
......
......@@ -2,7 +2,7 @@ TESTDLL = atl.dll
IMPORTS = uuid atl oleaut32 ole32 rpcrt4 user32 gdi32 advapi32
EXTRADEFS = -D_ATL_VER=_ATL_VER_30
C_SRCS = \
SOURCES = \
atl_ax.c \
module.c \
registrar.c
......@@ -73,20 +73,20 @@ static void test_AtlAxAttachControl(void)
IUnknown *pObj, *pContainer;
hr = pAtlAxAttachControl(NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "Expected AtlAxAttachControl to return E_INVALIDARG, got 0x%08x\n", hr);
ok(hr == E_INVALIDARG, "Expected AtlAxAttachControl to return E_INVALIDARG, got 0x%08lx\n", hr);
pContainer = (IUnknown *)0xdeadbeef;
hr = pAtlAxAttachControl(NULL, NULL, &pContainer);
ok(hr == E_INVALIDARG, "Expected AtlAxAttachControl to return E_INVALIDARG, got 0x%08x\n", hr);
ok(hr == E_INVALIDARG, "Expected AtlAxAttachControl to return E_INVALIDARG, got 0x%08lx\n", hr);
ok(pContainer == (IUnknown *)0xdeadbeef,
"Expected the output container pointer to be untouched, got %p\n", pContainer);
hr = pAtlAxAttachControl(NULL, hwnd, NULL);
ok(hr == E_INVALIDARG, "Expected AtlAxAttachControl to return E_INVALIDARG, got 0x%08x\n", hr);
ok(hr == E_INVALIDARG, "Expected AtlAxAttachControl to return E_INVALIDARG, got 0x%08lx\n", hr);
hr = CoCreateInstance(&CLSID_WebBrowser, NULL, CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,
&IID_IOleObject, (void **)&pObj);
ok(hr == S_OK, "Expected CoCreateInstance to return S_OK, got 0x%08x\n", hr);
ok(hr == S_OK, "Expected CoCreateInstance to return S_OK, got 0x%08lx\n", hr);
if (FAILED(hr))
{
......@@ -95,16 +95,16 @@ static void test_AtlAxAttachControl(void)
}
hr = pAtlAxAttachControl(pObj, NULL, NULL);
ok(hr == S_FALSE, "Expected AtlAxAttachControl to return S_FALSE, got 0x%08x\n", hr);
ok(hr == S_FALSE, "Expected AtlAxAttachControl to return S_FALSE, got 0x%08lx\n", hr);
pContainer = NULL;
hr = pAtlAxAttachControl(pObj, NULL, &pContainer);
ok(hr == S_FALSE, "Expected AtlAxAttachControl to return S_FALSE, got 0x%08x\n", hr);
ok(hr == S_FALSE, "Expected AtlAxAttachControl to return S_FALSE, got 0x%08lx\n", hr);
ok(pContainer != NULL, "got %p\n", pContainer);
IUnknown_Release(pContainer);
hr = pAtlAxAttachControl(pObj, hwnd, NULL);
ok(hr == S_OK, "Expected AtlAxAttachControl to return S_OK, got 0x%08x\n", hr);
ok(hr == S_OK, "Expected AtlAxAttachControl to return S_OK, got 0x%08lx\n", hr);
IUnknown_Release(pObj);
......@@ -115,7 +115,6 @@ static void test_ax_win(void)
{
BOOL ret;
WNDCLASSEXW wcex;
static const WCHAR AtlAxWin[] = {'A','t','l','A','x','W','i','n',0};
static HMODULE hinstance = 0;
ret = AtlAxWinInit();
......@@ -124,7 +123,7 @@ static void test_ax_win(void)
hinstance = GetModuleHandleA(NULL);
memset(&wcex, 0, sizeof(wcex));
wcex.cbSize = sizeof(wcex);
ret = GetClassInfoExW(hinstance, AtlAxWin, &wcex);
ret = GetClassInfoExW(hinstance, L"AtlAxWin", &wcex);
ok(ret, "AtlAxWin has not registered\n");
ok(wcex.style == CS_GLOBALCLASS, "wcex.style %08x\n", wcex.style);
}
......
......@@ -25,6 +25,7 @@
#define COBJMACROS
#include <atlbase.h>
#include <atlwin.h>
#include <wine/test.h>
......@@ -69,29 +70,29 @@ static void test_winmodule(void)
winmod.m_pCreateWndList = (void*)0xdeadbeef;
winmod.m_csWindowCreate.LockCount = 0xdeadbeef;
hres = AtlModuleInit(&winmod, NULL, NULL);
ok(hres == S_OK, "AtlModuleInit failed: %08x\n", hres);
ok(hres == S_OK, "AtlModuleInit failed: %08lx\n", hres);
ok(!winmod.m_pCreateWndList, "winmod.m_pCreateWndList = %p\n", winmod.m_pCreateWndList);
ok(winmod.m_csWindowCreate.LockCount == -1, "winmod.m_csWindowCreate.LockCount = %d\n",
ok(winmod.m_csWindowCreate.LockCount == -1, "winmod.m_csWindowCreate.LockCount = %ld\n",
winmod.m_csWindowCreate.LockCount);
AtlModuleAddCreateWndData(&winmod, create_data, (void*)0xdead0001);
ok(winmod.m_pCreateWndList == create_data, "winmod.m_pCreateWndList != create_data\n");
ok(create_data[0].m_pThis == (void*)0xdead0001, "unexpected create_data[0].m_pThis %p\n", create_data[0].m_pThis);
ok(create_data[0].m_dwThreadID == GetCurrentThreadId(), "unexpected create_data[0].m_dwThreadID %x\n",
ok(create_data[0].m_dwThreadID == GetCurrentThreadId(), "unexpected create_data[0].m_dwThreadID %lx\n",
create_data[0].m_dwThreadID);
ok(!create_data[0].m_pNext, "unexpected create_data[0].m_pNext %p\n", create_data[0].m_pNext);
AtlModuleAddCreateWndData(&winmod, create_data+1, (void*)0xdead0002);
ok(winmod.m_pCreateWndList == create_data+1, "winmod.m_pCreateWndList != create_data\n");
ok(create_data[1].m_pThis == (void*)0xdead0002, "unexpected create_data[1].m_pThis %p\n", create_data[1].m_pThis);
ok(create_data[1].m_dwThreadID == GetCurrentThreadId(), "unexpected create_data[1].m_dwThreadID %x\n",
ok(create_data[1].m_dwThreadID == GetCurrentThreadId(), "unexpected create_data[1].m_dwThreadID %lx\n",
create_data[1].m_dwThreadID);
ok(create_data[1].m_pNext == create_data, "unexpected create_data[1].m_pNext %p\n", create_data[1].m_pNext);
AtlModuleAddCreateWndData(&winmod, create_data+2, (void*)0xdead0003);
ok(winmod.m_pCreateWndList == create_data+2, "winmod.m_pCreateWndList != create_data\n");
ok(create_data[2].m_pThis == (void*)0xdead0003, "unexpected create_data[2].m_pThis %p\n", create_data[2].m_pThis);
ok(create_data[2].m_dwThreadID == GetCurrentThreadId(), "unexpected create_data[2].m_dwThreadID %x\n",
ok(create_data[2].m_dwThreadID == GetCurrentThreadId(), "unexpected create_data[2].m_dwThreadID %lx\n",
create_data[2].m_dwThreadID);
ok(create_data[2].m_pNext == create_data+1, "unexpected create_data[2].m_pNext %p\n", create_data[2].m_pNext);
......@@ -113,9 +114,58 @@ static void test_winmodule(void)
ok(winmod.m_pCreateWndList == create_data+1, "winmod.m_pCreateWndList != create_data\n");
}
static DWORD cb_val;
static void test_winclassinfo(void)
{
_ATL_MODULEW winmod;
HRESULT hres;
int len, expectedLen;
ATOM atom;
WNDPROC wndProc;
_ATL_WNDCLASSINFOW wci =
{
/* .m_wc = */
{
sizeof(WNDCLASSEXW),
CS_VREDRAW | CS_HREDRAW,
DefWindowProcW,
0,
0,
NULL,
NULL,
LoadCursorW(NULL, (LPCWSTR)IDC_ARROW),
(HBRUSH)(COLOR_BTNFACE + 1),
NULL,
NULL, /* LPCSTR lpszClassName; <-- We force ATL class name generation */
NULL
},
/* .m_lpszOrigName = */ NULL,
/* .pWndProc = */ NULL,
/* .m_lpszCursorID = */ (LPCWSTR)IDC_ARROW,
/* .m_bSystemCursor = */ TRUE,
/* .m_atom = */ 0,
/* .m_szAutoName = */ L""
};
winmod.cbSize = sizeof(winmod);
winmod.m_pCreateWndList = (void*)0xdeadbeef;
hres = AtlModuleInit(&winmod, NULL, NULL);
ok(hres == S_OK, "AtlModuleInit failed: %08lx\n", hres);
ok(!winmod.m_pCreateWndList, "winmod.m_pCreateWndList = %p\n", winmod.m_pCreateWndList);
atom = AtlModuleRegisterWndClassInfoW(&winmod, &wci, &wndProc);
ok(atom, "AtlModuleRegisterWndClassInfoA failed: %08x\n", atom);
ok(atom == wci.m_atom, "(atom = %08x) is != than (wci.m_atom = %08x)\n", atom, wci.m_atom);
static void WINAPI term_callback(DWORD dw)
ok(wcsncmp(wci.m_szAutoName, L"ATL:", 4) == 0, "wci.m_szAutoName = '%ls', expected starting with 'ATL:'\n", wci.m_szAutoName);
len = wcslen(wci.m_szAutoName);
expectedLen = sizeof("ATL:") + sizeof(void *) * 2 - 1;
ok(len == expectedLen, "wci.m_szAutoName has length %d, expected length %d\n", len, expectedLen);
}
static DWORD_PTR cb_val;
static void WINAPI term_callback(DWORD_PTR dw)
{
cb_val = dw;
}
......@@ -123,38 +173,42 @@ static void WINAPI term_callback(DWORD dw)
static void test_term(void)
{
_ATL_MODULEW test;
ULONG_PTR ex;
HRESULT hres;
ex = (ULONG_PTR)-37;
test.cbSize = sizeof(_ATL_MODULEW);
hres = AtlModuleInit(&test, NULL, NULL);
ok (hres == S_OK, "AtlModuleInit failed (0x%x).\n", (int)hres);
ok (hres == S_OK, "AtlModuleInit failed (0x%lx).\n", hres);
hres = AtlModuleAddTermFunc(&test, term_callback, 0x22);
ok (hres == S_OK, "AtlModuleAddTermFunc failed (0x%x).\n", (int)hres);
hres = AtlModuleAddTermFunc(&test, term_callback, ex);
ok (hres == S_OK, "AtlModuleAddTermFunc failed (0x%lx).\n", hres);
cb_val = 0xdeadbeef;
hres = AtlModuleTerm(&test);
ok (hres == S_OK, "AtlModuleTerm failed (0x%x).\n", (int)hres);
ok (cb_val == 0x22, "wrong callback value (0x%x).\n", (int)cb_val);
ok (hres == S_OK, "AtlModuleTerm failed (0x%lx).\n", hres);
ok (cb_val == ex, "wrong callback value (0x%Ix).\n", cb_val);
test.cbSize = FIELD_OFFSET(_ATL_MODULEW, dwAtlBuildVer);
hres = AtlModuleInit(&test, NULL, NULL);
ok (hres == S_OK, "AtlModuleInit failed (0x%x).\n", (int)hres);
ok (hres == S_OK, "AtlModuleInit failed (0x%lx).\n", hres);
hres = AtlModuleAddTermFunc(&test, term_callback, 0x23);
ok (hres == S_OK, "AtlModuleAddTermFunc failed (0x%x).\n", (int)hres);
ok (hres == S_OK, "AtlModuleAddTermFunc failed (0x%lx).\n", hres);
cb_val = 0xdeadbeef;
hres = AtlModuleTerm(&test);
ok (hres == S_OK, "AtlModuleTerm failed (0x%x).\n", (int)hres);
ok (cb_val == 0xdeadbeef, "wrong callback value (0x%x).\n", (int)cb_val);
ok (hres == S_OK, "AtlModuleTerm failed (0x%lx).\n", hres);
ok (cb_val == 0xdeadbeef, "wrong callback value (0x%Ix).\n", cb_val);
}
START_TEST(module)
{
test_StructSize();
test_winmodule();
test_winclassinfo();
test_term();
}
......@@ -42,13 +42,19 @@ static const char textA[] =
"{ \n"
" ForceRemove eebf73c4-50fd-478f-bbcf-db212221227a \n"
" { \n"
" val 'string' = s 'string' \n"
" val 'str1' = s 'string' \n"
" val 'str2' = s 'str\\\"ing' \n"
" val 'str3' = s 'str''ing' \n"
" val 'dword_quoted_dec' = d '1' \n"
" val 'dword_unquoted_dec' = d 1 \n"
" val 'dword_quoted_hex' = d '0xA' \n"
" val 'dword_unquoted_hex' = d 0xA \n"
" val 'dword_negative' = d -2147483648 \n"
" val 'dword_ulong' = d 2147483649 \n"
" val 'dword_max' = d 4294967295 \n"
" val 'dword_overrange' = d 4294967296 \n"
" val 'binary_quoted' = b 'deadbeef' \n"
" val 'binary_unquoted' = b deadbeef \n"
" val 'binary_unquoted' = b dead0123 \n"
" } \n"
"}";
......@@ -57,7 +63,24 @@ static void test_registrar(void)
IRegistrar *registrar = NULL;
HRESULT hr;
INT count;
int i;
WCHAR *textW = NULL;
struct dword_test
{
const char *name;
BOOL preserved;
LONGLONG value;
} dword_tests[] =
{
{ "dword_unquoted_dec", TRUE, 1 },
{ "dword_quoted_dec", TRUE, 1 },
{ "dword_quoted_hex", FALSE, 0xA },
{ "dword_unquoted_hex", FALSE, 0xA },
{ "dword_negative", FALSE, -2147483648 },
{ "dword_ulong", TRUE, 2147483649 },
{ "dword_max", TRUE, 4294967295 },
{ "dword_overrange", FALSE, 4294967296 },
};
if (!GetProcAddress(GetModuleHandleA("atl.dll"), "AtlAxAttachControl"))
{
......@@ -68,7 +91,7 @@ static void test_registrar(void)
hr = CoCreateInstance(&CLSID_Registrar, NULL, CLSCTX_INPROC_SERVER, &IID_IRegistrar, (void**)&registrar);
if (FAILED(hr))
{
win_skip("creating IRegistrar failed, hr = 0x%08X\n", hr);
win_skip("creating IRegistrar failed, hr = 0x%08lX\n", hr);
return;
}
......@@ -81,10 +104,11 @@ static void test_registrar(void)
LONG lret;
HKEY key;
BYTE bytes[4];
char buffer[16];
MultiByteToWideChar(CP_ACP, 0, textA, -1, textW, count);
hr = IRegistrar_StringRegister(registrar, textW);
ok(hr == S_OK, "StringRegister failed: %08x\n", hr);
ok(hr == S_OK, "StringRegister failed: %08lx\n", hr);
if (FAILED(hr))
{
IRegistrar_Release(registrar);
......@@ -92,44 +116,50 @@ static void test_registrar(void)
}
lret = RegOpenKeyA(HKEY_CURRENT_USER, "eebf73c4-50fd-478f-bbcf-db212221227a", &key);
ok(lret == ERROR_SUCCESS, "error %d opening registry key\n", lret);
ok(lret == ERROR_SUCCESS, "error %ld opening registry key\n", lret);
size = sizeof(dword);
lret = RegQueryValueExA(key, "dword_unquoted_hex", NULL, NULL, (BYTE*)&dword, &size);
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %d\n", lret);
ok(dword != 0xA, "unquoted hex is not supposed to be preserved\n");
size = sizeof(buffer);
lret = RegQueryValueExA(key, "str1", NULL, NULL, (BYTE*)buffer, &size);
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %ld\n", lret);
ok(!strcmp( buffer, "string"), "wrong data %s\n", debugstr_a(buffer));
size = sizeof(dword);
lret = RegQueryValueExA(key, "dword_quoted_hex", NULL, NULL, (BYTE*)&dword, &size);
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %d\n", lret);
ok(dword != 0xA, "quoted hex is not supposed to be preserved\n");
size = sizeof(buffer);
lret = RegQueryValueExA(key, "str2", NULL, NULL, (BYTE*)buffer, &size);
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %ld\n", lret);
ok(!strcmp( buffer, "str\\\"ing"), "wrong data %s\n", debugstr_a(buffer));
size = sizeof(dword);
lret = RegQueryValueExA(key, "dword_unquoted_dec", NULL, NULL, (BYTE*)&dword, &size);
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %d\n", lret);
ok(dword == 1, "unquoted dec is not supposed to be %d\n", dword);
size = sizeof(buffer);
lret = RegQueryValueExA(key, "str3", NULL, NULL, (BYTE*)buffer, &size);
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %ld\n", lret);
ok(!strcmp( buffer, "str'ing"), "wrong data %s\n", debugstr_a(buffer));
size = sizeof(dword);
lret = RegQueryValueExA(key, "dword_quoted_dec", NULL, NULL, (BYTE*)&dword, &size);
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %d\n", lret);
ok(dword == 1, "quoted dec is not supposed to be %d\n", dword);
for (i = 0; i < ARRAYSIZE(dword_tests); i++)
{
size = sizeof(dword);
lret = RegQueryValueExA(key, dword_tests[i].name, NULL, NULL, (BYTE*)&dword, &size);
ok(lret == ERROR_SUCCESS, "Test %d: RegQueryValueExA failed %ld.\n", i, lret);
if (dword_tests[i].preserved)
ok(dword == dword_tests[i].value, "Test %d: got unexpected value %lu.\n", i, dword);
else
ok(dword != dword_tests[i].value, "Test %d: is not supposed to be preserved.\n", i);
}
size = 4;
lret = RegQueryValueExA(key, "binary_quoted", NULL, NULL, bytes, &size);
ok(lret == ERROR_SUCCESS, "RegQueryValueA, failed, error %d\n", lret);
ok(lret == ERROR_SUCCESS, "RegQueryValueA, failed, error %ld\n", lret);
ok(bytes[0] == 0xde && bytes[1] == 0xad && bytes[2] == 0xbe && bytes[3] == 0xef,
"binary quoted value was not preserved (it's 0x%02X%02X%02X%02X)\n",
0xff & bytes[0], 0xff & bytes[1], 0xff & bytes[2], 0xff & bytes[3]);
size = 4;
lret = RegQueryValueExA(key, "binary_unquoted", NULL, NULL, bytes, &size);
ok(lret == ERROR_SUCCESS, "RegQueryValueA, failed, error %d\n", lret);
ok(bytes[0] == 0xde && bytes[1] == 0xad && bytes[2] == 0xbe && bytes[3] == 0xef,
ok(lret == ERROR_SUCCESS, "RegQueryValueA, failed, error %ld\n", lret);
ok(bytes[0] == 0xde && bytes[1] == 0xad && bytes[2] == 0x01 && bytes[3] == 0x23,
"binary unquoted value was not preserved (it's 0x%02X%02X%02X%02X)\n",
0xff & bytes[0], 0xff & bytes[1], 0xff & bytes[2], 0xff & bytes[3]);
hr = IRegistrar_StringUnregister(registrar, textW);
ok(SUCCEEDED(hr), "IRegistrar_StringUnregister failed, hr = 0x%08X\n", hr);
ok(SUCCEEDED(hr), "IRegistrar_StringUnregister failed, hr = 0x%08lX\n", hr);
RegCloseKey(key);
HeapFree(GetProcessHeap(), 0, textW);
......@@ -148,7 +178,7 @@ static void test_aggregation(void)
hres = CoCreateInstance(&CLSID_Registrar, (IUnknown*)0xdeadbeef, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_IUnknown, (void**)&unk);
ok(hres == CLASS_E_NOAGGREGATION || broken(hres == E_INVALIDARG),
"CoCreateInstance failed: %08x, expected CLASS_E_NOAGGREGATION\n", hres);
"CoCreateInstance failed: %08lx, expected CLASS_E_NOAGGREGATION\n", hres);
ok(!unk || unk == (IUnknown*)0xdeadbeef, "unk = %p\n", unk);
}
......
......@@ -4,9 +4,8 @@ IMPORTS = uuid ole32 oleaut32 user32 gdi32 advapi32 shlwapi
EXTRADEFS = -D_ATL_VER=_ATL_VER_100
PARENTSRC = ../atl
C_SRCS = \
SOURCES = \
atl.c \
atl_ax.c \
atl_lib.idl \
registrar.c
IDL_SRCS = atl_lib.idl
......@@ -2,5 +2,5 @@ TESTDLL = atl100.dll
IMPORTS = uuid atl100 oleaut32 ole32 advapi32 user32
EXTRADEFS = -D_ATL_VER=_ATL_VER_100
C_SRCS = \
SOURCES = \
atl.c