CreateFile failed with 5 - createfile

I'm using win xp Professional x64 Edition and I'm trying to send message to Windows Message Service like using net send. I'm using mailslot:
LPCTSTR SlotName = TEXT("\\\\.\\mailslot\\messngr");
hFile = CreateFile(SlotName,
GENERIC_WRITE | GENERIC_READ,
FILE_SHARE_WRITE | FILE_SHARE_READ,
(LPSECURITY_ATTRIBUTES)NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
(HANDLE)NULL);
and after launching it, I got error 5 from GetLastError() in CreateFile. I don't know how to fix it. I gave all VM permission, I turned message service ofc, and I can open it to be notpad like others suggested in: CreateFile() Failed With GetLastError() = 5. I tried many flags, but it didn't change anything. Any guess?

Like it says in the mailslot documentation, only the process that created the mailslot can read from it. Mailslots are one-way communication.
Remove the request for read access.

Related

Couchbase Java SDK times out with BUCKET_NOT_AVAILABLE

I am doing a lookup operation Couchbase Java SDK 3.0.9 which looks like this:
// Set up
bucket = cluster.bucket("my_bucket")
collection = bucket.defaultCollection()
// Look up operation
val specs = listOf(LookupInSpecStandard.get("hash"))
collection.lookupIn(id, specs)
The error I get is BUCKET_NOT_AVAILABLE. Here are is the full message:
com.couchbase.client.core.error.UnambiguousTimeoutException: SubdocGetRequest, Reason: TIMEOUT {"cancelled":true,"completed":true,"coreId":"0xdb7f8e4800000003","idempotent":true,"reason":"TIMEOUT","requestId":608806,"requestType":"SubdocGetRequest","retried":39,"retryReasons":["BUCKET_NOT_AVAILABLE"],"service":{"bucket":"export","collection":"_default","documentId":"export:main","opaque":"0xcfefb","scope":"_default","type":"kv"},"timeoutMs":15000,"timings":{"totalMicros":15008977}}
The strange part is that this code hasn't been touched for months and the lookup broke out of a sudden. The CB cluster is working fine. Its version is
Enterprise Edition 6.5.1 build 6299.
Do you have any ideas what might have gone wrong?
Note that in Couchbase Java SDK 3.x, the Cluster::bucket method returns instantly, and continues opening a bucket in the background. So the first operation you perform - a lookupIn here - needs to wait for that resource opening to complete before it can proceed. It looks like it took a little longer to access the Couchbase bucket than usual and you got a timeout.
I recommend using the Bucket::waitUntilReady method after opening a bucket, to block until the resource opening is complete:
bucket = cluster.bucket("my_bucket")
bucket.waitUntilReady(Duration.ofMinutes(1));
This problem can occur because of firewall. You need to allow these ports.
Client-to-node
Unencrypted: 8091-8097, 9140 [3], 11210
Encrypted: 11207, 18091-18095, 18096, 18097
You can check more from below
https://docs.couchbase.com/server/current/install/install-ports.html#_footnotedef_2

com.hierynomus.mssmb2.SMBApiException: STATUS_NETWORK_NAME_DELETED exception

I am getting the following error stack trace, when I am trying to connect an SMB share that I connect using the library most of the time, so yes the code mostly works but sometimes not. I could not try anything yet because I do not have any idea about what can be wrong, the share config, the network or the code, no idea.
com.hierynomus.mssmb2.SMBApiException: STATUS_NETWORK_NAME_DELETED (0xc00000c9): Authentication failed for 'your-user' using com.hierynomus.smbj.auth.NtlmAuthenticator#565d98da
com.hierynomus.smbj.connection.Connection.authenticate(Connection.java:182)
Here is my SmbConfig and I am using the 0.9.1 of smbj.
SmbConfig config = SmbConfig.builder()
.withMultiProtocolNegotiate(true)
.withSigningRequired(true)
.withDfsEnabled(true)
.build();
Here https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-smb/6ab6ca20-b404-41fd-b91a-2ed39e3762ea it gives more information about 0xC00000C9 - STATUS_NETWORK_NAME_DELETED exception and says
The network name specified by the client has been deleted on the
server. This error is returned if the client specifies an incorrect
TID or the share on the server represented by the TID was deleted.
Should I think something happened to the share on the windows server during the execution of the code?

STM32 StdPeriph library USART example

I downloaded Stdperiph library and i want to make USART example run on STM32F4 - Discovery. I chose STM32F40_41xxx workplace, added stm32f324x7i.c file and compiled without any errors.
Issue is that I cant receive expected message in my terminal (using Hercules), also when I check RxBuffer it is receiving some bytes but not that I sent.
I checked baudrate, wordlength, parity several times. Do you have any idea what could I do wrong?
USART conf:
USART_InitStructure.USART_BaudRate = 9600;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_2;
USART_InitStructure.USART_Parity = USART_Parity_Odd;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
STM_EVAL_COMInit(COM1, &USART_InitStructure);
Thank you.
First of all if you want to use hihg level abstraction libraries stop using obsolete SPL and start using HAL. Install the Cube. Generate the code - import into your favorite IDE and compile. Should work.
Your code does not show anything as USART clock may be net enabled as well as GPIOs. GPIOs may be configured wrong way. You system and peripheral clock may have wrong frequency. There are many more potential problems.

HTTP Communication failure - 500 Native SSL error

We are using Google API to compute mileage for our travel. Everything was working fine for over 1 year, however we started having the below said issue in the last couple of months.
Our program is able to connect to the API, the API returning with the error message http_communication_failure. The exact error is Application Server
Error 500 Native SSL error
Error is logged with Tag: {0001fee7}Thu Jun
21 09:36:49 2018
When I pasted the URL in the browser, it is returning the mileage information. However through the API call (receive data) in the program, we are getting this error message.
No program changes or Certificate changes have been done in the last 1 year. Our Basis team looked in to the possible issues with SSL. Everything seems to be OK from our end. I looked through your troubleshooting page, and tried all the suggested solutions. Nothing seem to fix our problem. Please let us know what else we need to look at.
CONCATENATE 'https://maps.googleapis.com/maps/api/distancematrix/xml?origins=' lv_dep '&destinations=' lv_arr '&units=imperial'
'&key=' lv_key
INTO lv_http_url.
CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = lv_http_url
ssl_id = 'ANONYM'
IMPORTING
client = lo_http_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
others = 4.
IF sy-subrc EQ 0.
lo_http_client->send( EXCEPTIONS http_communication_failure = 1
http_invalid_state = 2 ).
CALL METHOD lo_http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
others = 4.
See if port 443 is create in Trns: smicm, if you can't see it, create it.
increase the trace in menu go to->trace level.
call Appi and see log.
if you see a error about SSL, export the certificate from your PC, I supose is "google trust service".
go trns: STRUST in SAP and inport the new certificate.

Is Windows.Media.Ocr API available on Windows IoT Core with RaspberryPi 2?

I checked out many places for the answer but couldn't get one. According to this page the API should be available. But, when I run the codes on RaspberryPi 2, I get Unhandled Exception Error. To ensure that my codes are correct I ran the codes on my local machine, it runs perfectly fine.
Windows.Media.Ocr is universal API, so it is available.
With RaspberryPy there are no any language resources installed on device.
On such device, if you try code like following, ocrEngine will be null.
var ocrEngine = OcrEngine.TryCreateFromLanguage(new Language("en"));
You can check for available language recognizers with OcrEngine.AvailableRecognizerLanguages property.