IDA常用宏定义函数

news2024/11/25 7:02:20

一.引言

做题目遇到了几个神奇的函数.
SDWORD1(x), SDWORD2(x), SHIDWORD(x)
通过查询得知是IDA的宏定义函数
宏定义本身类似字符串替换,假设#define x 666
只是编译器在预处理阶段进行宏展开,将所有的x替换为666,然后再进行编译

二.IDA宏定义头文件

可以在路径\IDA_Pro_7.7\plugins\hexrays_sdk\include中找到defs.h文件
文件内容如下:

/*

   This file contains definitions used in the Hex-Rays decompiler output.
   It has type definitions and convenience macros to make the
   output more readable.

   Copyright (c) 2007-2022 Hex-Rays

*/

#ifndef HEXRAYS_DEFS_H
#define HEXRAYS_DEFS_H

#if defined(__GNUC__)
  typedef          long long ll;
  typedef unsigned long long ull;
  #define __int64 long long
  #define __int32 int
  #define __int16 short
  #define __int8  char
  #define MAKELL(num) num ## LL
  #define FMT_64 "ll"
#elif defined(_MSC_VER)
  typedef          __int64 ll;
  typedef unsigned __int64 ull;
  #define MAKELL(num) num ## i64
  #define FMT_64 "I64"
#elif defined (__BORLANDC__)
  typedef          __int64 ll;
  typedef unsigned __int64 ull;
  #define MAKELL(num) num ## i64
  #define FMT_64 "L"
#else
  #error "unknown compiler"
#endif
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned long ulong;

typedef          char   int8;
typedef   signed char   sint8;
typedef unsigned char   uint8;
typedef          short  int16;
typedef   signed short  sint16;
typedef unsigned short  uint16;
typedef          int    int32;
typedef   signed int    sint32;
typedef unsigned int    uint32;
typedef ll              int64;
typedef ll              sint64;
typedef ull             uint64;

// Partially defined types. They are used when the decompiler does not know
// anything about the type except its size.
#define _BYTE  uint8
#define _WORD  uint16
#define _DWORD uint32
#define _QWORD uint64
#if !defined(_MSC_VER)
#define _LONGLONG __int128
#endif

// Non-standard boolean types. They are used when the decompiler cannot use
// the standard "bool" type because of the size mistmatch but the possible
// values are only 0 and 1. See also 'BOOL' type below.
typedef int8 _BOOL1;
typedef int16 _BOOL2;
typedef int32 _BOOL4;
typedef int64 _BOOL8;

#ifndef _WINDOWS_
typedef int8 BYTE;
typedef int16 WORD;
typedef int32 DWORD;
typedef int32 LONG;
typedef int BOOL;       // uppercase BOOL is usually 4 bytes
#endif
typedef int64 QWORD;
#ifndef __cplusplus
typedef int bool;       // we want to use bool in our C programs
#endif

#define __pure  // pure function:
                // when given the same arguments, always returns the same value
                // has no side effects

// Non-returning function
#if defined(__GNUC__)
#define __noreturn  __attribute__((noreturn))
#else
#define __noreturn  __declspec(noreturn)
#endif


#ifndef NULL
#define NULL 0
#endif

// Some convenience macros to make partial accesses nicer
#define LAST_IND(x,part_type)    (sizeof(x)/sizeof(part_type) - 1)
#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
#  define LOW_IND(x,part_type)   LAST_IND(x,part_type)
#  define HIGH_IND(x,part_type)  0
#else
#  define HIGH_IND(x,part_type)  LAST_IND(x,part_type)
#  define LOW_IND(x,part_type)   0
#endif
// first unsigned macros:
#define BYTEn(x, n)   (*((_BYTE*)&(x)+n))
#define WORDn(x, n)   (*((_WORD*)&(x)+n))
#define DWORDn(x, n)  (*((_DWORD*)&(x)+n))

#define LOBYTE(x)  BYTEn(x,LOW_IND(x,_BYTE))
#define LOWORD(x)  WORDn(x,LOW_IND(x,_WORD))
#define LODWORD(x) DWORDn(x,LOW_IND(x,_DWORD))
#define HIBYTE(x)  BYTEn(x,HIGH_IND(x,_BYTE))
#define HIWORD(x)  WORDn(x,HIGH_IND(x,_WORD))
#define HIDWORD(x) DWORDn(x,HIGH_IND(x,_DWORD))
#define BYTE1(x)   BYTEn(x,  1)         // byte 1 (counting from 0)
#define BYTE2(x)   BYTEn(x,  2)
#define BYTE3(x)   BYTEn(x,  3)
#define BYTE4(x)   BYTEn(x,  4)
#define BYTE5(x)   BYTEn(x,  5)
#define BYTE6(x)   BYTEn(x,  6)
#define BYTE7(x)   BYTEn(x,  7)
#define BYTE8(x)   BYTEn(x,  8)
#define BYTE9(x)   BYTEn(x,  9)
#define BYTE10(x)  BYTEn(x, 10)
#define BYTE11(x)  BYTEn(x, 11)
#define BYTE12(x)  BYTEn(x, 12)
#define BYTE13(x)  BYTEn(x, 13)
#define BYTE14(x)  BYTEn(x, 14)
#define BYTE15(x)  BYTEn(x, 15)
#define WORD1(x)   WORDn(x,  1)
#define WORD2(x)   WORDn(x,  2)         // third word of the object, unsigned
#define WORD3(x)   WORDn(x,  3)
#define WORD4(x)   WORDn(x,  4)
#define WORD5(x)   WORDn(x,  5)
#define WORD6(x)   WORDn(x,  6)
#define WORD7(x)   WORDn(x,  7)

// now signed macros (the same but with sign extension)
#define SBYTEn(x, n)   (*((int8*)&(x)+n))
#define SWORDn(x, n)   (*((int16*)&(x)+n))
#define SDWORDn(x, n)  (*((int32*)&(x)+n))

#define SLOBYTE(x)  SBYTEn(x,LOW_IND(x,int8))
#define SLOWORD(x)  SWORDn(x,LOW_IND(x,int16))
#define SLODWORD(x) SDWORDn(x,LOW_IND(x,int32))
#define SHIBYTE(x)  SBYTEn(x,HIGH_IND(x,int8))
#define SHIWORD(x)  SWORDn(x,HIGH_IND(x,int16))
#define SHIDWORD(x) SDWORDn(x,HIGH_IND(x,int32))
#define SBYTE1(x)   SBYTEn(x,  1)
#define SBYTE2(x)   SBYTEn(x,  2)
#define SBYTE3(x)   SBYTEn(x,  3)
#define SBYTE4(x)   SBYTEn(x,  4)
#define SBYTE5(x)   SBYTEn(x,  5)
#define SBYTE6(x)   SBYTEn(x,  6)
#define SBYTE7(x)   SBYTEn(x,  7)
#define SBYTE8(x)   SBYTEn(x,  8)
#define SBYTE9(x)   SBYTEn(x,  9)
#define SBYTE10(x)  SBYTEn(x, 10)
#define SBYTE11(x)  SBYTEn(x, 11)
#define SBYTE12(x)  SBYTEn(x, 12)
#define SBYTE13(x)  SBYTEn(x, 13)
#define SBYTE14(x)  SBYTEn(x, 14)
#define SBYTE15(x)  SBYTEn(x, 15)
#define SWORD1(x)   SWORDn(x,  1)
#define SWORD2(x)   SWORDn(x,  2)
#define SWORD3(x)   SWORDn(x,  3)
#define SWORD4(x)   SWORDn(x,  4)
#define SWORD5(x)   SWORDn(x,  5)
#define SWORD6(x)   SWORDn(x,  6)
#define SWORD7(x)   SWORDn(x,  7)

// Generate a pair of operands. S stands for 'signed'
#define __SPAIR16__(high, low)  (((int16)  (high) <<  8) | (uint8) (low))
#define __SPAIR32__(high, low)  (((int32)  (high) << 16) | (uint16)(low))
#define __SPAIR64__(high, low)  (((int64)  (high) << 32) | (uint32)(low))
#define __SPAIR128__(high, low) (((int128) (high) << 64) | (uint64)(low))
#define __PAIR16__(high, low)   (((uint16) (high) <<  8) | (uint8) (low))
#define __PAIR32__(high, low)   (((uint32) (high) << 16) | (uint16)(low))
#define __PAIR64__(high, low)   (((uint64) (high) << 32) | (uint32)(low))
#define __PAIR128__(high, low)  (((uint128)(high) << 64) | (uint64)(low))

// Helper functions to represent some assembly instructions.

#ifdef __cplusplus

// compile time assertion
#define __CASSERT_N0__(l) COMPILE_TIME_ASSERT_ ## l
#define __CASSERT_N1__(l) __CASSERT_N0__(l)
#define CASSERT(cnd) typedef char __CASSERT_N1__(__LINE__) [(cnd) ? 1 : -1]

// check that unsigned multiplication does not overflow
template<class T> bool is_mul_ok(T count, T elsize)
{
  CASSERT(T(-1) > 0); // make sure T is unsigned
  if ( elsize == 0 || count == 0 )
    return true;
  return count <= T(-1) / elsize;
}

// multiplication that saturates (yields the biggest value) instead of overflowing
// such a construct is useful in "operator new[]"
template<class T> bool saturated_mul(T count, T elsize)
{
  return is_mul_ok(count, elsize) ? count * elsize : T(-1);
}

#include <stddef.h> // for size_t

// memcpy() with determined behavoir: it always copies
// from the start to the end of the buffer
// note: it copies byte by byte, so it is not equivalent to, for example, rep movsd
inline void *qmemcpy(void *dst, const void *src, size_t cnt)
{
  char *out = (char *)dst;
  const char *in = (const char *)src;
  while ( cnt > 0 )
  {
    *out++ = *in++;
    --cnt;
  }
  return dst;
}

// rotate left
template<class T> T __ROL__(T value, int count)
{
  const uint nbits = sizeof(T) * 8;

  if ( count > 0 )
  {
    count %= nbits;
    T high = value >> (nbits - count);
    if ( T(-1) < 0 ) // signed value
      high &= ~((T(-1) << count));
    value <<= count;
    value |= high;
  }
  else
  {
    count = -count % nbits;
    T low = value << (nbits - count);
    value >>= count;
    value |= low;
  }
  return value;
}

inline uint8  __ROL1__(uint8  value, int count) { return __ROL__((uint8)value, count); }
inline uint16 __ROL2__(uint16 value, int count) { return __ROL__((uint16)value, count); }
inline uint32 __ROL4__(uint32 value, int count) { return __ROL__((uint32)value, count); }
inline uint64 __ROL8__(uint64 value, int count) { return __ROL__((uint64)value, count); }
inline uint8  __ROR1__(uint8  value, int count) { return __ROL__((uint8)value, -count); }
inline uint16 __ROR2__(uint16 value, int count) { return __ROL__((uint16)value, -count); }
inline uint32 __ROR4__(uint32 value, int count) { return __ROL__((uint32)value, -count); }
inline uint64 __ROR8__(uint64 value, int count) { return __ROL__((uint64)value, -count); }

// sign flag
template<class T> int8 __SETS__(T x)
{
  if ( sizeof(T) == 1 )
    return int8(x) < 0;
  if ( sizeof(T) == 2 )
    return int16(x) < 0;
  if ( sizeof(T) == 4 )
    return int32(x) < 0;
  return int64(x) < 0;
}

// overflow flag of subtraction (x-y)
template<class T, class U> int8 __OFSUB__(T x, U y)
{
  if ( sizeof(T) < sizeof(U) )
  {
    U x2 = x;
    int8 sx = __SETS__(x2);
    return (sx ^ __SETS__(y)) & (sx ^ __SETS__(U(x2-y)));
  }
  else
  {
    T y2 = y;
    int8 sx = __SETS__(x);
    return (sx ^ __SETS__(y2)) & (sx ^ __SETS__(T(x-y2)));
  }
}

// overflow flag of addition (x+y)
template<class T, class U> int8 __OFADD__(T x, U y)
{
  if ( sizeof(T) < sizeof(U) )
  {
    U x2 = x;
    int8 sx = __SETS__(x2);
    return ((1 ^ sx) ^ __SETS__(y)) & (sx ^ __SETS__(U(x2+y)));
  }
  else
  {
    T y2 = y;
    int8 sx = __SETS__(x);
    return ((1 ^ sx) ^ __SETS__(y2)) & (sx ^ __SETS__(T(x+y2)));
  }
}

// https://en.wikipedia.org/wiki/Carry_flag#Carry_flag_vs._borrow_flag
#if defined(__ARM__) || defined(__PPC__)
#define SUB_WITH_CARRY 1
#else
#define SUB_WITH_CARRY 0
#endif

// carry flag of subtraction (x-y)
template<class T, class U> int8 __CFSUB__(T x, U y)
{
  int size = sizeof(T) > sizeof(U) ? sizeof(T) : sizeof(U);
  bool res;
  if ( size == 1 )
    res = uint8(x) < uint8(y);
  else if ( size == 2 )
    res = uint16(x) < uint16(y);
  else if ( size == 4 )
    res = uint32(x) < uint32(y);
  else
    res = uint64(x) < uint64(y);
#if SUB_WITH_CARRY
  res = !res;
#endif
  return res;
}

// carry flag of addition (x+y)
template<class T, class U> int8 __CFADD__(T x, U y)
{
  int size = sizeof(T) > sizeof(U) ? sizeof(T) : sizeof(U);
  if ( size == 1 )
    return uint8(x) > uint8(x+y);
  if ( size == 2 )
    return uint16(x) > uint16(x+y);
  if ( size == 4 )
    return uint32(x) > uint32(x+y);
  return uint64(x) > uint64(x+y);
}

// carry flag of subtraction with carry
template<class T, class U> int8 __CFSUB__(T x, U y, int8 cf)
{
#if SUB_WITH_CARRY
  cf = !cf;
#endif
  return __CFADD__(y, cf) ^ __CFSUB(x, y + cf);
}

// overflow flag of subtraction with carry
template<class T, class U> int8 __OFSUB__(T x, U y, int8 cf)
{
#if SUB_WITH_CARRY
  cf = !cf;
#endif
  return __OFADD__(y, cf) ^ __OFSUB(x, y + cf);
}

inline uint8   abs8(int8     x) { return x >= 0 ? x : -x; }
inline uint16  abs16(int16   x) { return x >= 0 ? x : -x; }
inline uint32  abs32(int32   x) { return x >= 0 ? x : -x; }
inline uint64  abs64(int64   x) { return x >= 0 ? x : -x; }
//inline uint128 abs128(int128 x) { return x >= 0 ? x : -x; }

#include <string.h>     // for memcpy
#include <type_traits>  // for enable_if

template <typename T, typename F>
inline typename std::enable_if<sizeof(T) <= sizeof(F), T>::type __coerce(F f)
{
  T t;
  memcpy(&t, &f, sizeof(T));
  return t;
}
#define COERCE_FLOAT(v) __coerce<float>(v)
#define COERCE_DOUBLE(v) __coerce<double>(v)
#define COERCE_LONG_DOUBLE(v) __coerce<long double>(v)
#define COERCE_UNSIGNED_INT(v) __coerce<unsigned int>(v)
#define COERCE_UNSIGNED_INT64(v) __coerce<uint64>(v)

#else // C++
// For C, we just provide macros, they are not quite correct.
#define __ROL__(x, y) __rotl__(x, y)      // Rotate left
#define __ROR__(x, y) __rotr__(x, y)      // Rotate right
#define __CFSHL__(x, y) invalid_operation // Generate carry flag for (x<<y)
#define __CFSHR__(x, y) invalid_operation // Generate carry flag for (x>>y)
#define __CFADD__(x, y) invalid_operation // Generate carry flag for (x+y)
#define __CFSUB__(x, y) invalid_operation // Generate carry flag for (x-y)
#define __OFADD__(x, y) invalid_operation // Generate overflow flag for (x+y)
#define __OFSUB__(x, y) invalid_operation // Generate overflow flag for (x-y)

#define abs8(x)   (int8)  ((int8)  (x) >= 0 ? (x) : -(x))
#define abs16(x)  (int16) ((int16) (x) >= 0 ? (x) : -(x))
#define abs32(x)  (int32) ((int32) (x) >= 0 ? (x) : -(x))
#define abs64(x)  (int64) ((int64) (x) >= 0 ? (x) : -(x))
#define abs128(x) (int128)((int128)(x) >= 0 ? (x) : -(x))

#endif // C++

#if defined(__MIPS__)
// traps for MIPS arithmetic operation
void __noreturn __integer_oveflow(void); // SIGFPE/FPE_INTOVF
void __noreturn __divide_by_zero(void);  // SIGFPE/FPE_INTDIV
void __noreturn __trap(uint16 trapcode); // SIGTRAP
void __noreturn __break(uint16 code, uint16 subcode);
#endif

#define __SETP__(x, y)   invalid_operation // Generate parity flag for (x-y)

// In the decompilation listing there are some objects declared as _UNKNOWN
// because we could not determine their types. Since the C compiler does not
// accept void item declarations, we replace them by anything of our choice,
// for example a char:

#define _UNKNOWN char

#ifdef _MSC_VER
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#endif

// The ADJ() macro is used for shifted pointers.
// While compilers do not understand it, it makes the code more readable.
// A shifted pointer is declared like this, for example:
//      char *__shifted(mystruct,8) p;
// It means: while 'p' points to 'char', it also points to the middle of 'mystruct'.
// More precisely, it is at the offset of 8 bytes from the beginning of 'mystruct'.
//
// The ADJ() macro performs the necessary adjustment.
// The __parentof() and __deltaof() functions are made up, they do not exist.
// __parentof() returns the parent structure type.
// __deltaof() returns the shift amount.

#define ADJ(p) (__parentof(p) *)(p-__deltaof(p))

#endif // HEXRAYS_DEFS_H

三.SHIDWORD()功能解释

  1. 定义: #define SHIDWORD(x) (((int32)&(x)+1))
    这里是ida老版本的定义,ida7.7的定义略有不同,为方便解释使用该定义

  2. 功能:获取64位整数的高32位,并将其转换为32位有符号整数

  3. 引用ChatGPT的解释:
    在这里插入图片描述

  4. 实验代码:

#include <stdint.h>
#define SHIDWORD(x)  (*((__int32*)&(x)+1))
#include <stdio.h>
#include <xkeycheck.h>
int main()
{

	uint64_t x = 0xffffffff00000000;		// 定义unsigned int64无符号整数
	printf("%llu\n", x);					// 以llu形式输出
	printf("%llu\n", *(&x));				//打印解引用后的值 本身该指针是一个unsigned int64* 型指针 
	printf("%016llx\n", &x);				//打印指针值
	printf("%016llx\n", (__int32*)&(x));	//打印指向低32位的指针 此时已经被强制转换成int32* 型指针,变成有符号数
	printf("%016llx\n", (__int32*)&(x)+1);  //打印指向高32位的指针
	printf("%x\n", SHIDWORD(x));			//打印x的高32位16进制值
	printf("%d\n",SHIDWORD(x));				//由于解引用int32*指针返回的是32位有符号数,所以0xffffffff被识别为-1
	return 0;
}

输出结果:
在这里插入图片描述

四.参考文章

  1. IDA逆向常用宏定义
  2. 代码还原,IDA中使用的宏

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/507629.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Dubbo2.7 纯注解使用+ Nacos + Springboot 整合集成

Dubbo2.7 纯注解使用 NacosSpringboot 环境准备篇相关依赖nacos准备代码编写服务提供者服务使用者整体结构图 结果 常规操作篇服务分组服务版本参数传递泛化调用参数校验只订阅延迟暴露服务端异步回调多协议复用多注册中心本地存根 服务治理篇超时时间重试并发控制权限控制服务…

css04笔记

目录 盒子模型 5.7 外边距折叠现象 – ① 合并现象 5.8 外边距折叠现象 – ② 塌陷现象 5.9 行内元素的margin和padding无效情况 一、结构伪类选择器 &#xff08;了解&#xff09;nth-of-type结构伪类选择器 二、伪元素 三、标准流 四、浮动 浮动的代码&#xff1a; …

用 Pygal 模拟掷骰子

这篇博客&#xff0c;我们将学习使用 python可视化包 Pygal 来生成矢量图形文件。针对于需要在尺寸不同的屏幕上显示的图表具有很大用处。因为它们可以自动缩放&#xff0c;以此来适合观看者的屏幕。 . 在这个项目中&#xff0c;我们将对掷骰子的结果进行分析。掷6面的常规骰子…

<Linux> 基础IO(文件操作、文件描述符fd、重定向)

基础IO&#xff08;文件操作、文件描述符fd、重定向&#xff09; 文章目录 基础IO&#xff08;文件操作、文件描述符fd、重定向&#xff09;一、回顾C和C的文件操作二、C语言文件IO1.什么是当前路径&#xff1f;2.C语言文件接口汇总3.默认打开的三个流 三、系统文件IO1.open2.c…

真题详解(索引长度计算)-软件设计(七十一)

真题详解(哈希冲突)-软件设计&#xff08;七十)https://blog.csdn.net/ke1ying/article/details/130566800 在面向对象系统中&#xff0c;一个类定义了大体相似的对象&#xff0c;这些对象共享_____。 属性和行为。 &#xff08;属性就是状态&#xff09; 数据库主要分为用户…

shapefile.js实现shp数据的上传与展示

概述 shapefile是常见的矢量数据格式&#xff0c;但是由于其文件组成结构很难在webgis上直接展示。本文通过express和compressing实现打包后shapefile文件的上传&#xff0c;并结合shapefile.js实现shapefile数据的转换展示。 实现效果 实现代码 1. 后端实现 router.post(/…

Android 引入hunter-debug监测代码运行时函数耗时和参数及返回值,Java(1)

Android 引入hunter-debug监测代码运行时函数耗时和参数及返回值&#xff0c;Java&#xff08;1&#xff09; &#xff08;1&#xff09;在工程的根build.gradle文件里面添加cn.quinnchen.hunter:hunter-debug-plugin引用&#xff1a; buildscript {repositories {mavenCentra…

SAP CAP篇三:定义Model

SAP CAP篇一:快速创建一个Service&#xff0c;基于Java的实现 SAP CAP篇二&#xff1a;为Service加上数据库支持 文章目录 理解CAP的ModelDomain-Driven DesignKISSBasic TypesCommon Reuse TypecuidmanagedtemporalCountry, Currency, LanguagecodeList Assocation & Comp…

匹配算法之 匈牙利算法详解

参考&#xff1a; 算法学习笔记(5)&#xff1a;匈牙利算法漫谈匈牙利算法匈牙利算法、KM算法匈牙利算法&#xff08;二分图&#xff09;通俗易懂小白入门&#xff09;二分图最大匹配——匈牙利算法多目标跟踪之数据关联&#xff08;匈牙利匹配算法和KM算法&#xff09;【小白学…

手把手教你使用gtest写单元测试

开源框架&#xff1a;gtest&#xff0c;它主要用于写单元测试&#xff0c;检查真自己的程序是否符合预期行为。这不是QA&#xff08;测试工程师&#xff09;才学的&#xff0c;也是每个优秀后端开发codoer的必备技能。 本期博文内容及使用的demo&#xff0c;参考&#xff1a; …

40、Java 并发编程基础 ①

目录 一、进程&#xff08;Process&#xff09;二、线程&#xff08;Thread&#xff09;三、线程的串行四、多线程五、多线程原理六、多线程优缺点七、Java 的默认线程八、开启新线程(1) new Thread()(2) 继承 Thread&#xff0c;重写 run 方法(3) run() 和 start() 九、多线程…

AutoCV第八课:3D基础

目录 3D基础前言1. nuScenes数据集2. nuScenes数据格式3. 点云可视化总结 3D基础 前言 手写 AI 推出的全新保姆级从零手写自动驾驶 CV 课程&#xff0c;链接。记录下个人学习笔记&#xff0c;仅供自己参考。 本次课程主要学习点云数据的可视化。 课程大纲可看下面的思维导图。…

【Shiro】SimpleAuthenticationInfo如何验证password

一、前言 通篇的关键就是知道ShiroRealm类重写的doGetAuthenticationInfo这个方法&#xff0c;到底是谁的方法。 从上图我们可以知道&#xff0c;ShiroRealm最终继承到了AuthenticatingRealm这个方法。 二、自定义的ShiroRealm类 ps&#xff1a;该图中①上的注释是没看过底…

Jetpack之livedata原理

1.LiveData是什么&#xff1f; 只有在生命周期处于started和resumed时。livedata才会更新观察者 2.Livedata的各种使用方式 1.更新数据 class MainActivity : AppCompatActivity() {override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceSta…

c++之函数对象和谓词

目录 函数对象&#xff1a; 谓词&#xff1a; 一元谓词函数举例如下 二元谓词举例如下 函数对象和函数的区别 一元谓词的案例 二元函数对象案例 二元谓词案例 函数对象&#xff1a; 重载函数调用操作符的类&#xff0c;其对象常称为函数对象&#xff08;function obj…

内网渗透之linux到linux横向移动-ssh

0x01 一般情况下SSH密钥存放在~/.ssh/目录下&#xff0c;也可以文件中搜索已保存的SSH凭证 ~/.ssh/config ~/.ssh/known_hosts ~/.bash_history grep -ir "BEGIN RSA PRIVATE KEY" /* grep -ir "BEGIN DSA PRIVATE KEY" /* grep -ir "BEGIN OPENSSH…

SpringBoot入门学习笔记-快速认识

SpringBoot入门学习笔记-快速认识 快速案例入门案例解析parentstarter引导类内嵌tomcat ) 快速案例 在controller定义一个类 package com.ustc.sp5.controller;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.…

redis 数据类型简介

redis 数据类型 redis的五种数据类型是&#xff1a;1、string&#xff08;字符串&#xff09;&#xff1b;2、hash&#xff08;哈希&#xff09;&#xff1b;3、list&#xff08;列表&#xff09;&#xff1b;4、set&#xff08;集合&#xff09;&#xff1b;5、sort set &…

QT初体验:手把手带你写一个自己的串口助手

前言 本文记录一下用QT Creator 写一个基本功能齐全的串口助手的过程&#xff0c;整个工程只有几百行代码&#xff0c;跟着做下来对新手来说可以更快了解整个QT项目的开发过程和一些常用控件的使用方法。对新手学习QT能增强信心&#xff0c;话不多说&#xff0c;正文开始 先看…

Mysql日志redo log、bin log、undo log 区别与作用及二阶段提交

一、redo log 重做日志 作用&#xff1a;确保事务的持久性。防止在发生故障的时间点&#xff0c;尚有脏页未写入磁盘&#xff0c;在重启mysql服务的时候&#xff0c;根据redo log进行重做&#xff0c;从而达到事务的持久性这一特性。 内容&#xff1a;物理格式的日志&#x…