Disabling BCD testsigning option using registry - bcdedit

My code should disable testsigning BCD option using Windows registry. The same as command line bcdedit -set testsigning off.
I can't do shellexecute with cmd. I found one Testsigning reference in registry, in HKLM\SYSTEM\ControlSet001\Control\SystemStartOptions value, but this value contains current kernel run options, not options for next start.
So, I can't use it.
I found that testsigning option are saved in HLKM\BCD00000000\Objects\{%GUID%}\Elements\16000049, but this GUID is different on different PC's.
How I could acquire it?

If you don't bother of activating it for all boot entries:
Enumerate all key names beneath "Objects"
Write your registry values in a loop into every found key name.
Using NT native API your approach could look something like the following pseudocode:
while(numEntries < index){
NtEnumerateKey(index++, &pGuidKeyname...);
RtlStringCbPrintfW(buf, %s, rootkey,pGuidKeyname);
NtSetValueKey(buf, "YES");
}

Related

sqlite3_key missing from header in iOS 11 framework [duplicate]

I am working on SQLite File Encryption. I have added sqlCipher & crypto frameworks successfully in my project.
Now when I try to compile my application on this line
int rc = sqlite3_key(database, [key UTF8String], strlen([key UTF8String]));
it says Implicit declaration of function 'sqlite3_key'
So above line "implicit declaration" sounds to me like function is defined but not declared. But where I have to declared ?
While searching over Internet, under this article, it says like SQLite Encryption Extension(SEE) is not available publically. I have to purchase it of cost around $2000.
SEE -> http://www.hwaci.com/sw/sqlite/see.html
So this is the only reason I am getting Implicit declaration & False response while sqlite encryption process ?
If you are using SQLCipher, you need to define SQLITE_HAS_CODEC in your application's C Flags. Thats all.
Yes, that is the reason you are getting that compiler warning. The function sqlite3_key() is not defined in the version of libsqlite3 included with iOS. Adding in a function declaration isn't going to help-- it would fix that compiler warning, but it would just mean you'll get a linker error since the function isn't defined anywhere.
If you purchased SEE you could probably build your own copy of SQLite, embed it in your app, and just not use the system's libsqlite3. That this would mean you'd have to say "yes" when the app store submission process asks if your app includes encryption, meaning extra paperwork and time before you could submit the app. I'm not certain whether there's any clear indication of whether Apple would accept it even then-- probably they would, but they've been known to surprise people.

OpenJpa2.0 How to map Oracle sys.XMLTYPE column to String

I changed Change in persistence.xml
I also changed column definition (columnDefinition="XDB.XMLType") for xml fields
I checked OpenJpa(http://openjpa.208410.n2.nabble.com/Oracle-XMLType-fetch-problems-td6208344.html) site and IBM (http://www.ibm.com/support/knowledgecenter/SS7J6S_7.5.0/com.ibm.wsadapters.jca.jdbc.doc/env/doc/rjdb_problemsolutions.html)
My env is OpenJpa 2.0 and WAS 7
its throwing exception
org.apache.openjpa.persistence.PersistenceException: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "SYS.XMLTYPE", line 169
Please suggest without changing OpenJpa2.0 as its part of IBM WebSphere Application Server V7.0 how can i handle sys.XMLTYPE data, i am migrating my application from db2 to Oracle in same environment.
Writing XML data can be tricky some times! Getting the correct drivers and things defined properly can have its challenges. I can not say exactly what you need to do given the lack of info on your domain model and such, but let me give some general things to look for. First, there is an XML test in the OpenJPA test framework if you want to make reference to it. It can be seen publicly here:
https://apache.googlesource.com/openjpa/+/refs/heads/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/oracle/
Or, another test using an "XMLValueHandler" (likely this is beyond the scope of what you are looking for):
https://apache.googlesource.com/openjpa/+/refs/heads/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xmlmapping/query/
Second, (stating the obvious) I assume you have a column in Oracle defined as "XMLTYPE". Also, I see you are using schema SYS. I'm sure you are aware but this is a system/admin schema......just for sanity sake you might want to first get things running using a non-system/admin schema just so we don't get hung up with any issues with your OpenJPA client not having the correct permissions.
Next, you need the following definition:
#Lob #Basic
#Column(name = "ANXMLCOLUMN", columnDefinition="XMLCOLUMN XMLType")
private String anXMLString;
The #Lob I think will be necessary if you are using data greater than 4000 chars (this was mentioned in one of the comments). To start I'd use a very small set of data (a couple characters), once that works, then experiment with > 4k.
Next, make sure to use the correct JDBC driver. The last time I experimented with an XMLType I used the Oracle JDBC 11.2.0.2 driver.
Finally, you might need to use the property "openjpa.jdbc.DBDictionary" with value "oracle(supportsSetClob=true,maxEmbeddedClobSize=-1)". Again, experiment with this AND look at the OpenJPA documentation on these properties to determine if they are necessary in your scenario. I think the supportsSetClob=true will only be necessary for older version (pre-2.2.x) of OpenJPA. You might also need to use property "openjpa.jdbc.SchemaFactory" with value "native". I would suggest you first try without either or these two properties. If that doesn't help, then experiment with these two properties. I know this is vague, but I don't know what your DDL or domain model looks like so I have to keep in vague.
Thanks,
Heath Thomann

How to suppress -mmax value exceeded.Automatically increasing from old value to new value.<5409>?

in prokb,its mentioned
In 10.0B02 and above, the client session startup parameter -noincrwarn was reintroduced
to allow the selective suppression of the above four warning messages ONLY. Since the
execution of the 4GL statement: SESSION:SUPPRESS-WARNINGS = YES. suppresses ALL warning
messages during the session.
Where and how could i set i this startup parameter -noincrwarn to suppress this warning
message?
"SESSION:SUPPRESS-WARNINGS = YES." doesn't do much of anything useful. Or at least it didn't the last time I tested it.
The -mmax warning is harmless. It is a "soft" limit that is dynamically allocated and expanded as needed. You can ignore it. Or if the .lg file entries really bother you, you can simply increase it to a reasonable value. I routinely set it to 8192 for character sessions, 32768 for Windows. The default, as JensD says, is ludicrously low.
Startup parameters, such as -noincwarn, can set in a number of ways:
1) Via the command line. If your application starts via a script it will eventually invoke progress via "pro", "mpro", progress, prowin32, proapsv or some other executable (you can potentially link your own objects and create custom executables...) The command line that invokes Progress will have a number of parameters. You could add it there. Windows example:
#echo off
set DLC=\Progress\OpenEdge
%DLC%\bin\prowin32 -db mydb -p start.p -noincwarn
(On windows it is also common for the shortcut properties to have the command line listed.)
2) In a "pf" file. "PF" files are parameter files. They contain a list of parameters in a text file. This makes it easy to share and manage parameters between many scripts. To use a parameter file you need at least one -pf filename.pf parameter. Unix example:
#!/bin/sh
DLC=/usr/dlc
export DLC
${DLC}/bin/_progres -db mydb -pf mypf.pf
Where "mypf.pf" might contain:
# mypf.pf
-p start.p
-noincwarn
There is a global .pf file in the Progress install directory called startup.pf. You could also add it to that.
3) In an "ini file". Sort of like the pf file but more complicated. Indicated by the -ininame startup parameter. Can also be influenced by registry keys.
Why not removing or trying another value for -mmax? If you're moving from an old version of Progress it might be that -mmax is set very low.
The Maximum Memory (-mmax) client session parameter specifies the maximum amount of memory allocated for r-code segments, in kilobytes.
Source: http://knowledgebase.progress.com/articles/Article/P11351?popup=true
Large memory consumption might depend on complicated business logic (things like very large and or deeply nested procedures) so you might consider looking into that.
However a much easier fix would be to increase the value. Default is 3096, meaning each client "only" gets 3 Mb for this. Not a very large amount with today's standards.
If you really only want to suppress the message. Set -noincrwarn in your client side startup script (or corresponding .pf-file/startup.pf).
Hosting a WPF element (windows Presentation Foundation) in an OpenEdge application can cause application to crash if any message cover the window. It is also the case of this message.
In order to suppress any messages including message 5409 ()
According to article "HOW TO SUPPRESS WARNING MESSAGES (5407),(5408),(5409),(5410) FROM DISPLAYING ON CLIENT SCREENS."
I used with expected results SESSION:SUPPRESS-WARNINGS = YES. As the first line in the starting procedure of the aplication.
Using -noincrwarn as the session startup parameter had no effect in Open Edge 11.4
Supress openedge messages:
http://knowledgebase.progress.com/articles/Article/P79795?popup=true
.NET related error for OpenEdge-WPF hibrid application "Invisible or disabled control cannot be activated"
https://social.msdn.microsoft.com/Forums/windows/en-US/e8cf6431-2a59-4335-8b36-fc8f35083823/invisible-or-disabled-control-cannot-be-activated?forum=winforms

Execute command line statement in installshield / installscript

How do I execute the following command in installscript during installation?
netsh.exe advfirewall firewall show rule name="PowerSI (Release ASI 16.64)" || NETSH.EXE advfirewall firewall add rule name="PowerSI (Release ASI 16.64)" dir=in action=allow program="d:\Cadence\HIM_asi1664\ASI\Update4\SpeedXP\SpeedXP Suite x64\PowerSI.exe" enable=yes profile=any description="d:\Cadence\HIM_asi1664\ASI\Update4\SpeedXP\SpeedXP Suite x64\PowerSI.exe"
Note that the above command contains the executable name i.e. netsh.exe twice and this is where the problem is. I tried LaunchAppAndWait first by using the whole command as the name of executable and passing an empty string as argument. Next I tried was passing the first netsh.exe as program name and the remaining text as argument. Both the approaches did not work.
Since the question is regarding InstallScript specifically, here's a simple function for this purpose.
// prototype void CmdExecute( STRING );
//---------------------------------------------------------------------------
// Function: CmdExecute
//
// Purpose: Asynchronusly execute a command line statement in the background
//
//---------------------------------------------------------------------------
function void CmdExecute( szCommand )
begin
LaunchApplication( "cmd.exe", "/C " + szCommand, "",
SW_HIDE, 0, LAAW_OPTION_NOWAIT );
end;
In your specific case, if you need to execute a series of commands, or if you run into other complications, I suggest using a batch file instead. If need be, you can write one on the fly (to have a pure installscript solution without adding files to the project), run it via LaunchApplication (or the variations of that) and then delete it afterwards.
As a nice little trick, I like to make such a batch file delete itself. How? At the end of it, add this:
cmd.exe /C timeout 30 >nul & del "%0" /q
This starts a separate process, so the batch file in no longer in use. The full 30 second delay isn't really necessary, but has proven to always work for me in the past. You can adjust that time, if you want it to hurry up and finish. The point is to make sure the batch can be deleted, which it can't be if it's in use.
Custom Action Wizard --> Launch an Exectuable --> Stored in the Directory table --> SystemFolder (as source)
Then for Target do: cmd /c "SOMETHING",
where SOMETHING is replaced with your command. The only thing you would need to worry about is escaping all of the double quotes.
Then sequence the action after "Cost Finalize" in the execute sequence, and you should be good.
Haven't fully tested it, but should work.

How do I create a UUID (GUID) in Livecode (or HyperTalk)?

How do I create a UUID (= Universally unique identifier, or GUID = Globally Unique Identifier, Microsoft speak) in Livecode or Hypercard?
The aim of UUIDs is to give practically unique keys to pieces of information without a central coordination.
References
Type 4 UUID (Wikipedia)
How to create a GUID in JavaScript
Is there any difference between GUID and UUID?
If you're on a Unix (like Linux or MacOS), you could use the shell() function to call the uuidgen Terminal command. It should be something like
put shell("uuidgen") into theUUID
That's a bit heavy-handed (creates a shell, runs a command line application in it, then quits it again), but will work on older LiveCode versions, and isn't that different from what a shell script does.
In HyperCard, you'd have to use AppleScript, either in an object whose script is set to AppleScript, or using the "do X as AppleScript" command. Not sure if AppleScript can natively build UUIDs, but if it can't, AppleScript can be used to run shell scripts. (The shell() function doesn't exist in HyperCard, it was invented by SuperCard, IIRC).
In case none of that helps, here's a specification that describes how to create a standard UUID: http://www.opengroup.org/dce/info/draft-leach-uuids-guids-01.txt It's not specific to any programming language.
In LiveCode 6.1 (released today) you can create a uuid using the uuid function. Type 4 random uuid is the default and type 3 and 5 digest based uuids are also implemented.
The following function creates a type 4 (random) UUID:
function getUUID
local tUUIDpattern
local tUUID
local tHexDigits
put "xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx" into tUUIDpattern
put "1234567890abcdef" into tHexDigits
repeat for each char tChar in tUUIDpattern
if tChar = "x" then
put any char of tHexDigits after tUUID
else
put tChar after tUUID
end if
end repeat
return tUUID
end getUUID
by now (at least in version 6.6.1) one can use put uuid(random) without shell
if the type is empty or random a version 4 (random) UUID is returned. A cryptographic quality pseudo-random number generator is used to generate the randomness.
If the type is md5 a version 3 UUID is returned.
If the type is sha1 a version 5 UUID is returned.

Resources