codeblocks/mingw & windres problems building a .dll (VST Plugin) with png resources - resources

I have a VST plugin that compiles fine with VS200X / MSVC. I am trying to make a Codeblocks/MinGW project also for users who prefer that environment.
When I build the dll with codeblocks it works in a VST host, with GUI, until I start trying to include resources (.png files)
I include the .rc file in the codeblocks project. The resource paths in my resource.h don't have spaces.
If i try and copy the built .dll file the OS has it locked. It is almost as if windres is not compiling the resources successfully and retains a handle on the file - although by the size of the .dll it looks like the resources are there. If I try and run the dll in a vst host via GDB it doesn't hit any breakpoints... presumably the host can't load the .dll.
here are the codeblocks cbp compiler settings...
<Target title="Release Win32">
<Option output="build-win-cb\IPlugEffect" prefix_auto="1" extension_auto="1" />
<Option working_dir="build-win-cb\" />
<Option object_output="build-win-cb\Release" />
<Option type="3" />
<Option compiler="gcc" />
<Option parameters="IPlugEffect.dll" />
<Option host_application="C:\Program Files\vsthost\vsthost.exe" />
<Compiler>
<Add option="-O3" />
<Add option="-msse2" />
<Add option="-ffast-math" />
<Add option="-DVST_API" />
<Add option="-DWIN32" />
<Add option="-D_WIN32_WINNT=0x0501" />
<Add option="-DWINVER=0x0501" />
<Add option="-D_CRT_SECURE_NO_DEPRECATE" />
<Add option="-DPNG_NO_ASSEMBLER_CODE" />
<Add option="-DPNG_LIBPNG_SPECIALBUILD" />
<Add option="-DDLL_BUILD" />
</Compiler>
</Target>
resource.h
...
// Unique IDs for each image resource.
#define KNOB_ID 101
// Image resource locations for this plug.
...
IPlugEffect.rc
#include "resource.h"
KNOB_ID PNG KNOB_FN
#define KNOB_FN "resources/img/knob.png"

problem solved. My dll symbol exports/visibility were not correct for gcc.
http://forum.cockos.com/showpost.php?p=835609&postcount=21

Related

elmah.mvc remote access, what should be set?

elmah.mvc should work with mvc5 smoothly?
To rule out any other problem, I created a new Web mvc project (with VS2015).
I added with nuget the Elmah.mvc package, and the configuration looks like this:
<add key="elmah.mvc.disableHandler" value="false" />
<add key="elmah.mvc.disableHandleErrorFilter" value="false" />
<add key="elmah.mvc.requiresAuthentication" value="true" />
<add key="elmah.mvc.IgnoreDefaultRoute" value="false" />
<add key="elmah.mvc.allowedRoles" value="super" />
<add key="elmah.mvc.allowedUsers" value="*" />
<add key="elmah.mvc.route" value="elmah" />
<add key="elmah.mvc.UserAuthCaseSensitive" value="true" />
From what I gathered documentation, that all that is needed to enable the user which have the super role, to access elmah page remotaly.
But when i publish to server, and i try access http://mysite/elmah page, if i not logged so I redicated to login page.
but after login as a user with the role requried, i get:
403 - Forbidden: Access is denied.
<elmah>
<security allowRemoteAccess="1"/>
</elmah>
It solved the problem (i.e: the elmha page accessible for user with the specified role). But that's not mentioned in the elmah.mvc documentation.

How to forbid access to all directories except one using web.config in IIS8?

I developed a web project based on Yii2, so it's necesarry to forbid access to all file and directory except the sub-directory "web".
Below is project directory struct:
.htaccess
composer.json
config/
console.php
web.php
commands/
controllers/
models/
runtime/
vendor/
views/
web/
.htaccess
assets/
index.php
I have achieved this under apache by .htaccess, it's very very easy ^_^
.htaccess
Order Allow,Deny
Deny from all
web/.htaccess
Order Allow,Deny
Allow from All
But I need to deploy this project under IIS8 now, so I tried to convert .htaccess to web.config using IIS management, but convert result is empty.
How can I do this? thanks
IIS uses the Request Filtering module to limit browser access to files that are components of the application. For the sample application in a Web.config file, the section could look like:
<security>
<requestFiltering>
<denyUrlSequences>
<add sequence="engine" />
<add sequence="inc" />
<add sequence="info" />
<add sequence="install" />
<add sequence="module" />
<add sequence="profile" />
<add sequence="po" />
<add sequence="sh" />
<add sequence="theme" />
<add sequence="tpl(\.php" />
<add sequence="Root" />
<add sequence="Tag" />
<add sequence="Template" />
<add sequence="Repository" />
<add sequence="code-style" />
</denyUrlSequences>
<fileExtensions>
<add fileExtension=".sql" allowed="false" />
<add fileExtension=".pl" allowed="false" />
</fileExtensions>
</requestFiltering>
</security>
Note that you can leave this section commented out for installation, because the installation scripts are blocked by this filter.
An alternative to using the request filtering is to use the URL Rewriter module to return a 403 error for any of the matching file types. The advantage of the URL Rewriter module is that it uses a regular expression for the match.
<rule name="Protect files and directories from prying eyes" stopProcessing="true">
<match url="\.(engine|inc|info|install|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$" />
<action type="CustomResponse" statusCode="403" subStatusCode="0"
statusReason="Forbidden"
statusDescription="Access is forbidden." />
</rule>

Web.config not being parametrized on deploy

I have an ASP MVC app that I'm deploying to intranet servers via TeamCity, and I need some appSettings to be parametrized on deploy, so that client secrets stay hidden from developers etc.
I have the Parameters.xml file in the root of my project, the SetParameters.xml that is built with the package correctly contains all these parameters and their default values. However changing these values (even passing them to MSDeploy with -setParam) doesn't result in any changes in deployed web.config.
When I change the values in the SetParameters.xml file (which is passed to MSDeploy correctly afaik), the settings in the deployed web.config don't change and while there are "Verbose: Parameter entry 'IIS Web Application Name/1' is applicable" entries in log (IIS Web Application Name being another, standard, parameter), there's no mention of my appSettings parameters.
Also When I import the application with IIS Manager, it asks me for the values for these parameters, but I don't see them mentioned in verbose logs either, and the web.config doesn't get updated at all unless there really were some changes, and in that case the parameters aren't replaced.
My parameters.xml look like this:
<?xml version="1.0" encoding="utf-8" ?>
<parameters>
<parameter name="PiwikToken" defaultValue="__PIWIKTOKEN__">
<parameterEntry type="XMLFile" scope="\\web\.config$" match="/configuration/appSettings/add[#key='PiwikToken']/#value"/>
</parameter>
<parameter name="LoginClientSecret" defaultValue="__LOGINSECRET__">
<parameterEntry type="XMLFile" scope="\\web\.config$" match="/configuration/appSettings/add[#key='LoginClientSecret']/#value"/>
</parameter>
<parameter name="SecondClientSecret" defaultValue="__SECONDSECRET__">
<parameterEntry type="XMLFile" scope="\\web\.config$" match="/configuration/appSettings/add[#key='SecondClientSecret']/#value"/>
</parameter>
</parameters>
I've tried other scope variations ("web.config$", "web.config", "\\web.config$", "\\web\.config$", "Portal\web.config$"...) and it didn't change a thing.
The XPath expressions tested against my web.config work OK.
web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="LoginClientId" value="portalLocal" />
<add key="RedirectAfterAuthUrl" value="https://localhost:44321/" />
<add key="PiwikSiteId" value="12" />
<add key="PiwikToken" value="__PIWIKTOKEN__" />
<add key="LoginClientSecret" value="__LOGINSECRET__" />
<add key="SecondClientSecret" value="__SECONDSECRET__" />
</appSettings>
<connectionStrings>
<add name="appDB" connectionString="..." />
</connectionStrings>
...
Other things I've checked:
Parametrization in MSDeploy is switched on
The file "parameters.xml", which is generated inside the .zip package, contains
<parameters>
<parameter name="IIS Web Application Name" defaultValue="Portal" tags="IisApp">
<parameterEntry kind="ProviderPath" scope="IisApp" match="^D:\\BuildAgent\\work\\fec2f9c37ed1ec8e\\Portal\\obj\\DEV\\Package\\PackageTmp$" />
<parameterEntry kind="ProviderPath" scope="setAcl" match="^D:\\BuildAgent\\work\\fec2f9c37ed1ec8e\\Portal\\obj\\DEV\\Package\\PackageTmp$" />
</parameter>
<parameter name="Add write permission to App_Data Folder" description="Add write permission to App_Data folder" defaultValue="{IIS Web Application Name}/App_Data" tags="Hidden">
<parameterEntry kind="ProviderPath" scope="setAcl" match="^D:\\BuildAgent\\work\\fec2f9c37ed1ec8e\\Portal\\obj\\DEV\\Package\\PackageTmp\\App_Data$" />
</parameter>
<parameter name="PiwikToken" defaultValue="__PIWIKTOKEN__" />
<parameter name="LoginClientSecret" defaultValue="__LOGINSECRET__" />
<parameter name="SecondClientSecret" defaultValue="__SECONDSECRET__" />
</parameters>
According to various sources across the net, the common cause for this would be that the scope is wrong or that the match regexp is wrong, but I've tried all kinds of variants without success.
If anyone has any ideas about what to try, or what could be the cause, I'll be glad to explore further or try it out, but right now I've spent a few days on this and cannot think of what else to try. Thanks!
EDIT: Now I've created a fresh WebAPI project with MVC, added just parameters.xml, added those parameters to web.config, and the web.config still doesn't get parametrized on deploy. So is it some IIS setting somewhere?
EDIT2: After experimenting I found out that the generated parameters.xml inside the zip package really should containt "match" and "scope" attributes and they don't - since when I rewrite the xml so that it contains parameterEntry with proper match and scope, and repackage it into the zip, it starts working.
EDIT3: And the problem seems to be having attribute named "type", when it should've been named "kind". Now I only wonder, where did I first get that example I used...
The problem was I had an attribute named "type" in my parameters.xml, when it should've been named "kind".
Found out thanks to https://forums.iis.net/t/1177518.aspx

How to remove alert message from NuGetGallery

I have installed NuGet on my machine, but I can't disable the Yellow Alert message "This is a development environment. No data will be preserved."
I have changed in my web.config this key
<add key="Gallery.Environment" value="Development" />
to
<add key="Gallery.Environment" value="Production" />
But it is still appearring... Any idea on where to look?
Delete file Alert.md from App_data folder

Unrecognized tag prefix or device filter 'sc' (in VS2012)

I can't get Visual Studio 2012 to recognize the 'sc' tagPrefix.
My web.config contains the usual line:
<add tagPrefix="sc" namespace="Sitecore.Web.UI.WebControls"
assembly="Sitecore.Kernel"/>
But I keep getting the Unrecognized tag prefix or device filter 'sc' message when I try to add a <sc /> tag to my page or user control.
If I open the same solution in Visual Studio 2010, it works fine.
Any ideas?
I finally found it.
The Web.Config that is provided by Sitecore contains the following section:
<pages validateRequest="false">
<controls>
<add tagPrefix="sc" namespace="Sitecore.Web.UI.WebControls" assembly="Sitecore.Kernel" />
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add tagPrefix="sc" namespace="Sitecore.Web.UI.WebControls" assembly="Sitecore.Analytics" />
</controls>
</pages>
For VS2012, you need to remove the asp tagprefixes, so the section ends up being:
<pages validateRequest="false">
<controls>
<add tagPrefix="sc" namespace="Sitecore.Web.UI.WebControls" assembly="Sitecore.Kernel" />
<add tagPrefix="sc" namespace="Sitecore.Web.UI.WebControls" assembly="Sitecore.Analytics" />
</controls>
</pages>
No idea why, but that solved the problem for me!
Little side note though: after this change, it won't work in VS2010 anymore.. (neither <sc: /> nor <asp: />)
if you have installed .net 4.5 it overrides the 4.0 and you would have other issues (depending on the specific sitecore version that you are running on...)
Add the below tag on top of the aspx file.
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
Add below tags in web.config file
<pages>
<controls>
<add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxToolkit"/>
</controls>
</pages>
On the Tools menu, click Choose Toolbox Items. Add AjaxControlToolkit.dll files if you don't have them. Click Browse, then an Open dialog box appears. In the My Places Bar, select My Computer to browse for items installed on your computer.

Resources